@@ -273,10 +273,10 @@ def time_merge_ordered(self):
273
273
274
274
275
275
class MergeAsof :
276
- params = [["backward" , "forward" , "nearest" ]]
277
- param_names = ["direction" ]
276
+ params = [["backward" , "forward" , "nearest" ], [ None , 5 ] ]
277
+ param_names = ["direction" , "tolerance" ]
278
278
279
- def setup (self , direction ):
279
+ def setup (self , direction , tolerance ):
280
280
one_count = 200000
281
281
two_count = 1000000
282
282
@@ -303,6 +303,9 @@ def setup(self, direction):
303
303
df1 ["time32" ] = np .int32 (df1 .time )
304
304
df2 ["time32" ] = np .int32 (df2 .time )
305
305
306
+ df1 ["timeu64" ] = np .uint64 (df1 .time )
307
+ df2 ["timeu64" ] = np .uint64 (df2 .time )
308
+
306
309
self .df1a = df1 [["time" , "value1" ]]
307
310
self .df2a = df2 [["time" , "value2" ]]
308
311
self .df1b = df1 [["time" , "key" , "value1" ]]
@@ -313,22 +316,52 @@ def setup(self, direction):
313
316
self .df2d = df2 [["time32" , "value2" ]]
314
317
self .df1e = df1 [["time" , "key" , "key2" , "value1" ]]
315
318
self .df2e = df2 [["time" , "key" , "key2" , "value2" ]]
319
+ self .df1f = df1 [["timeu64" , "value1" ]]
320
+ self .df2f = df2 [["timeu64" , "value2" ]]
321
+
322
+ def time_on_int (self , direction , tolerance ):
323
+ merge_asof (
324
+ self .df1a , self .df2a , on = "time" , direction = direction , tolerance = tolerance
325
+ )
316
326
317
- def time_on_int (self , direction ):
318
- merge_asof (self .df1a , self .df2a , on = "time" , direction = direction )
327
+ def time_on_int32 (self , direction , tolerance ):
328
+ merge_asof (
329
+ self .df1d , self .df2d , on = "time32" , direction = direction , tolerance = tolerance
330
+ )
319
331
320
- def time_on_int32 (self , direction ):
321
- merge_asof (self .df1d , self .df2d , on = "time32" , direction = direction )
332
+ def time_on_uint64 (self , direction , tolerance ):
333
+ merge_asof (
334
+ self .df1f , self .df2f , on = "timeu64" , direction = direction , tolerance = tolerance
335
+ )
322
336
323
- def time_by_object (self , direction ):
324
- merge_asof (self .df1b , self .df2b , on = "time" , by = "key" , direction = direction )
337
+ def time_by_object (self , direction , tolerance ):
338
+ merge_asof (
339
+ self .df1b ,
340
+ self .df2b ,
341
+ on = "time" ,
342
+ by = "key" ,
343
+ direction = direction ,
344
+ tolerance = tolerance ,
345
+ )
325
346
326
- def time_by_int (self , direction ):
327
- merge_asof (self .df1c , self .df2c , on = "time" , by = "key2" , direction = direction )
347
+ def time_by_int (self , direction , tolerance ):
348
+ merge_asof (
349
+ self .df1c ,
350
+ self .df2c ,
351
+ on = "time" ,
352
+ by = "key2" ,
353
+ direction = direction ,
354
+ tolerance = tolerance ,
355
+ )
328
356
329
- def time_multiby (self , direction ):
357
+ def time_multiby (self , direction , tolerance ):
330
358
merge_asof (
331
- self .df1e , self .df2e , on = "time" , by = ["key" , "key2" ], direction = direction
359
+ self .df1e ,
360
+ self .df2e ,
361
+ on = "time" ,
362
+ by = ["key" , "key2" ],
363
+ direction = direction ,
364
+ tolerance = tolerance ,
332
365
)
333
366
334
367
0 commit comments