Skip to content

Commit 3b038af

Browse files
mroeschkeproost
authored andcommitted
BENCH: Add rolling apply benchmarks (pandas-dev#28566)
* BENCH: Add rolling apply benchmarks * black
1 parent 623566f commit 3b038af

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

asv_bench/benchmarks/rolling.py

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ def peakmem_rolling(self, constructor, window, dtype, method):
2525
getattr(self.roll, method)()
2626

2727

28+
class Apply:
29+
params = (
30+
["DataFrame", "Series"],
31+
[10, 1000],
32+
["int", "float"],
33+
[sum, np.sum, lambda x: np.sum(x) + 5],
34+
[True, False],
35+
)
36+
param_names = ["contructor", "window", "dtype", "function", "raw"]
37+
38+
def setup(self, constructor, window, dtype, function, raw):
39+
N = 10 ** 5
40+
arr = (100 * np.random.random(N)).astype(dtype)
41+
self.roll = getattr(pd, constructor)(arr).rolling(window)
42+
43+
def time_rolling(self, constructor, window, dtype, function, raw):
44+
self.roll.apply(function, raw=raw)
45+
46+
2847
class ExpandingMethods:
2948

3049
params = (

0 commit comments

Comments
 (0)