Skip to content

Commit 28c6bba

Browse files
committed
PERF: add asv benchmarks for quantile()
1 parent c4994ca commit 28c6bba

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

asv_bench/benchmarks/algorithms.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,20 @@ def time_series_dates(self, df):
113113
hashing.hash_pandas_object(df['dates'])
114114

115115

116+
class Quantile(object):
117+
params = [[0, 0.5, 1],
118+
['linear', 'nearest', 'lower', 'higher', 'midpoint'],
119+
['float', 'int']]
120+
param_names = ['quantile', 'interpolation', 'dtype']
121+
122+
def setup(self, quantile, interpolation, dtype):
123+
N = 10**5
124+
data = {'int': np.arange(N),
125+
'float': np.random.randn(N)}
126+
self.idx = pd.Series(data[dtype].repeat(5))
127+
128+
def time_quantile(self, quantile, interpolation, dtype):
129+
self.idx.quantile(quantile, interpolation=interpolation)
130+
131+
116132
from .pandas_vb_common import setup # noqa: F401

0 commit comments

Comments
 (0)