Skip to content

Commit 0c51b40

Browse files
committed
additional cleanup
1 parent 8c36012 commit 0c51b40

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

asv_bench/benchmarks/rolling.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
import pandas as pd
22
import numpy as np
33

4-
from .pandas_vb_common import setup
4+
from .pandas_vb_common import setup # noqa
55

66

77
class Methods(object):
88

99
sample_time = 0.2
1010
params = (['DataFrame', 'Series'],
1111
[10, 1000],
12-
[10**4, 10**5],
1312
['int', 'float'],
1413
['median', 'mean', 'max', 'min', 'std', 'count', 'skew', 'kurt',
1514
'sum', 'corr', 'cov'])
16-
param_names = ['contructor', 'window', 'num_data', 'dtype', 'method']
15+
param_names = ['contructor', 'window', 'dtype', 'method']
1716

18-
def setup(self, contructor, window, num_data, dtype, method):
19-
arr = np.random.random(num_data).astype(dtype)
20-
self.data = getattr(pd, contructor)(arr)
17+
def setup(self, contructor, window, dtype, method):
18+
N = 10**5
19+
arr = np.random.random(N).astype(dtype)
20+
self.roll = getattr(pd, contructor)(arr).rolling(window)
2121

22-
def time_rolling(self, contructor, window, num_data, dtype, method):
23-
getattr(self.data.rolling(window), method)()
22+
def time_rolling(self, contructor, window, dtype, method):
23+
getattr(self.roll, method)()
2424

2525

2626
class Quantile(object):
2727

2828
sample_time = 0.2
2929
params = (['DataFrame', 'Series'],
3030
[10, 1000],
31-
[10**4, 10**5],
31+
['int', 'float'],
3232
[0, 0.5, 1])
33-
param_names = ['contructor', 'window', 'num_data', 'dtype', 'percentile']
33+
param_names = ['contructor', 'window', 'dtype', 'percentile']
3434

35-
def setup(self, contructor, window, num_data, dtype, percentile):
36-
arr = np.random.random(num_data).astype(dtype)
37-
self.data = getattr(pd, contructor)(arr)
35+
def setup(self, contructor, window, dtype, percentile):
36+
N = 10**5
37+
arr = np.random.random(N).astype(dtype)
38+
self.roll = getattr(pd, contructor)(arr).rolling(window)
3839

39-
def time_quantile(self, contructor, window, num_data, dtype, percentile):
40-
self.data.rolling(window).quantile(0.5)
40+
def time_quantile(self, contructor, window, dtype, percentile):
41+
self.roll.quantile(percentile)

0 commit comments

Comments
 (0)