MCPcopy
hub / github.com/pandas-dev/pandas / setup

Method setup

asv_bench/benchmarks/rolling.py:120–133  ·  view source on GitHub ↗
(self, constructor, dtype, window_kwargs, function, parallel, cols)

Source from the content-addressed store, hash-verified

118 ]
119
120 def setup(self, constructor, dtype, window_kwargs, function, parallel, cols):
121 N = 10**3
122 window, kwargs = window_kwargs
123 shape = (N, cols) if cols is not None and constructor != "Series" else N
124 arr = (100 * np.random.random(shape)).astype(dtype)
125 data = getattr(pd, constructor)(arr)
126
127 # Warm the cache
128 with warnings.catch_warnings(record=True):
129 # Catch parallel=True not being applicable e.g. 1D data
130 self.window = getattr(data, window)(**kwargs)
131 self.window.apply(
132 function, raw=True, engine="numba", engine_kwargs={"parallel": parallel}
133 )
134
135 def test_method(self, constructor, dtype, window_kwargs, function, parallel, cols):
136 with warnings.catch_warnings(record=True):

Callers

nothing calls this directly

Calls 2

astypeMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected