Skip to content

PERF: resample with max/min taking slow path #5927

Closed
@jreback

Description

@jreback
In [21]: df = DataFrame(np.random.randn(100000,2),index=date_range('20130101',periods=100000,freq='50L'))

In [19]: %timeit df.resample('1s',how=np.max)[0]
1 loops, best of 3: 902 ms per loop

mean is ok

In [22]: %timeit df.resample('1s',how=np.mean)[0]
100 loops, best of 3: 2.42 ms per loop

The way to do this actually is ohlc

In [20]: %timeit df.groupby(pd.TimeGrouper('1s'))[0].ohlc()
1000 loops, best of 3: 1.16 ms per loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypePerformanceMemory or execution speed performanceResampleresample method

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions