Skip to content

PERF: ewm passed with times is so slow compared to ewm pased with int #39784

Closed
@jasonzhang2s

Description

@jasonzhang2s
  • [yes ] I have checked that this issue has not already been reported.

  • [yes ] I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

# Your code here

idx=pd.date_range('20000101','20201231',periods=50000)

df=pd.DataFrame(data=range(50000),index=idx)

%%time
df.ewm(halflife=pd.Timedelta('100d'),times=df.index).mean()

CPU times: user 1min 13s, sys: 0 ns, total: 1min 13s
Wall time: 1min 13s


%%time
df.ewm(halflife=100).mean()

CPU times: user 1.72 ms, sys: 26 µs, total: 1.75 ms
Wall time: 1.16 ms

Problem description

ewm passed with times is so slow compared to ewm pased with int

Expected Output

ewm passed with time should be similar speed as ewm passed with int

version 1.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformanceMemory or execution speed performanceWindowrolling, ewma, expanding

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions