@@ -273,10 +273,10 @@ def time_merge_ordered(self):
273273
274274
275275class MergeAsof :
276- params = [["backward" , "forward" , "nearest" ]]
277- param_names = ["direction" ]
276+ params = [["backward" , "forward" , "nearest" ], [ None , 5 ] ]
277+ param_names = ["direction" , "tolerance" ]
278278
279- def setup (self , direction ):
279+ def setup (self , direction , tolerance ):
280280 one_count = 200000
281281 two_count = 1000000
282282
@@ -303,6 +303,9 @@ def setup(self, direction):
303303 df1 ["time32" ] = np .int32 (df1 .time )
304304 df2 ["time32" ] = np .int32 (df2 .time )
305305
306+ df1 ["timeu64" ] = np .uint64 (df1 .time )
307+ df2 ["timeu64" ] = np .uint64 (df2 .time )
308+
306309 self .df1a = df1 [["time" , "value1" ]]
307310 self .df2a = df2 [["time" , "value2" ]]
308311 self .df1b = df1 [["time" , "key" , "value1" ]]
@@ -313,22 +316,52 @@ def setup(self, direction):
313316 self .df2d = df2 [["time32" , "value2" ]]
314317 self .df1e = df1 [["time" , "key" , "key2" , "value1" ]]
315318 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+ )
316326
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+ )
319331
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+ )
322336
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+ )
325346
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+ )
328356
329- def time_multiby (self , direction ):
357+ def time_multiby (self , direction , tolerance ):
330358 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 ,
332365 )
333366
334367
0 commit comments