Skip to content

Commit 4597c7f

Browse files
committed
Add asv tests for DataFrame.asof
1 parent 4836cdf commit 4597c7f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

asv_bench/benchmarks/timeseries.py

+42
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,48 @@ def time_timeseries_asof_single(self):
335335
self.ts.asof(self.dates[0])
336336

337337

338+
class timeseries_dataframe_asof(object):
339+
goal_time = 0.2
340+
341+
def setup(self):
342+
self.N = 10000
343+
self.M = 1000
344+
self.rng = date_range(start='1/1/1990', periods=self.N, freq='53s')
345+
self.ts = DataFrame(np.random.randn(self.N * self.M).reshape((self.N, self.M)), index=self.rng)
346+
self.dates = date_range(start='1/1/1990', periods=(self.N * 10), freq='5s')
347+
348+
def time_timeseries_asof(self):
349+
self.ts.asof(self.dates)
350+
351+
352+
class timeseries_dataframe_asof_nan(object):
353+
goal_time = 0.2
354+
355+
def setup(self):
356+
self.N = 10000
357+
self.M = 1000
358+
self.rng = date_range(start='1/1/1990', periods=self.N, freq='53s')
359+
self.ts = DataFrame(np.random.randn(self.N * self.M).reshape((self.N, self.M)), index=self.rng)
360+
self.dates = date_range(start='1/1/1990', periods=(self.N * 10), freq='5s')
361+
self.ts[250:5000] = np.nan
362+
363+
def time_timeseries_asof_nan(self):
364+
self.ts.asof(self.dates)
365+
366+
367+
class timeseries_dataframe_asof_single(object):
368+
goal_time = 0.2
369+
370+
def setup(self):
371+
self.N = 10000
372+
self.M = 1000
373+
self.rng = date_range(start='1/1/1990', periods=self.N, freq='53s')
374+
self.ts = DataFrame(np.random.randn(self.N * self.M).reshape((self.N, self.M)), index=self.rng)
375+
self.dates = date_range(start='1/1/1990', periods=(self.N * 10), freq='5s')
376+
377+
def time_timeseries_asof_single(self):
378+
self.ts.asof(self.dates[0])
379+
338380
class timeseries_custom_bday_apply(object):
339381
goal_time = 0.2
340382

0 commit comments

Comments
 (0)