diff --git a/asv_bench/benchmarks/rolling.py b/asv_bench/benchmarks/rolling.py index b42fa553b495c..493f96d46d5e7 100644 --- a/asv_bench/benchmarks/rolling.py +++ b/asv_bench/benchmarks/rolling.py @@ -25,6 +25,25 @@ def peakmem_rolling(self, constructor, window, dtype, method): getattr(self.roll, method)() +class Apply: + params = ( + ["DataFrame", "Series"], + [10, 1000], + ["int", "float"], + [sum, np.sum, lambda x: np.sum(x) + 5], + [True, False], + ) + param_names = ["contructor", "window", "dtype", "function", "raw"] + + def setup(self, constructor, window, dtype, function, raw): + N = 10 ** 5 + arr = (100 * np.random.random(N)).astype(dtype) + self.roll = getattr(pd, constructor)(arr).rolling(window) + + def time_rolling(self, constructor, window, dtype, function, raw): + self.roll.apply(function, raw=raw) + + class ExpandingMethods: params = (