Skip to content

Commit a1fff60

Browse files
committed
Merge pull request #5960 from dsm054/more_resample_fast_paths
PERF: add np.max and np.min to _cython_table (GH5927)
2 parents 6641c83 + f2a8996 commit a1fff60

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

pandas/core/groupby.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,9 @@ def _reorder_by_uniques(uniques, labels):
29942994
np.prod: 'prod',
29952995
np.std: 'std',
29962996
np.var: 'var',
2997-
np.median: 'median'
2997+
np.median: 'median',
2998+
np.max: 'max',
2999+
np.min: 'min'
29983000
}
29993001

30003002

vb_suite/timeseries.py

+26
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,29 @@ def date_range(start=None, end=None, periods=None, freq=None):
243243
setup, start_date=datetime(2013, 9, 30))
244244

245245

246+
#----------------------------------------------------------------------
247+
# Resampling: fast-path various functions
248+
249+
setup = common_setup + """
250+
rng = date_range('20130101',periods=100000,freq='50L')
251+
df = DataFrame(np.random.randn(100000,2),index=rng)
252+
"""
253+
254+
dataframe_resample_mean_string = \
255+
Benchmark("df.resample('1s', how='mean')", setup)
256+
257+
dataframe_resample_mean_numpy = \
258+
Benchmark("df.resample('1s', how=np.mean)", setup)
259+
260+
dataframe_resample_min_string = \
261+
Benchmark("df.resample('1s', how='min')", setup)
262+
263+
dataframe_resample_min_numpy = \
264+
Benchmark("df.resample('1s', how=np.min)", setup)
265+
266+
dataframe_resample_max_string = \
267+
Benchmark("df.resample('1s', how='max')", setup)
268+
269+
dataframe_resample_max_numpy = \
270+
Benchmark("df.resample('1s', how=np.max)", setup)
271+

0 commit comments

Comments
 (0)