|
1 | 1 | import pandas as pd |
2 | 2 | import numpy as np |
3 | 3 |
|
4 | | -from .pandas_vb_common import setup |
| 4 | +from .pandas_vb_common import setup # noqa |
5 | 5 |
|
6 | 6 |
|
7 | 7 | class Methods(object): |
8 | 8 |
|
9 | 9 | sample_time = 0.2 |
10 | 10 | params = (['DataFrame', 'Series'], |
11 | 11 | [10, 1000], |
12 | | - [10**4, 10**5], |
13 | 12 | ['int', 'float'], |
14 | 13 | ['median', 'mean', 'max', 'min', 'std', 'count', 'skew', 'kurt', |
15 | 14 | 'sum', 'corr', 'cov']) |
16 | | - param_names = ['contructor', 'window', 'num_data', 'dtype', 'method'] |
| 15 | + param_names = ['contructor', 'window', 'dtype', 'method'] |
17 | 16 |
|
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) |
21 | 21 |
|
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)() |
24 | 24 |
|
25 | 25 |
|
26 | 26 | class Quantile(object): |
27 | 27 |
|
28 | 28 | sample_time = 0.2 |
29 | 29 | params = (['DataFrame', 'Series'], |
30 | 30 | [10, 1000], |
31 | | - [10**4, 10**5], |
| 31 | + ['int', 'float'], |
32 | 32 | [0, 0.5, 1]) |
33 | | - param_names = ['contructor', 'window', 'num_data', 'dtype', 'percentile'] |
| 33 | + param_names = ['contructor', 'window', 'dtype', 'percentile'] |
34 | 34 |
|
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) |
38 | 39 |
|
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