Skip to content

Adding Timedelta parameter to time-based .rolling() #15440

Closed
@chrisaycock

Description

@chrisaycock

Starting with a simple DataFrame:

n = 10
df = pd.DataFrame({'value': np.arange(n)},
                  index=pd.date_range('2015-12-24', periods=n, freq="D"))

I can invoke a time-based .rolling() with a string for the offset:

df.rolling('3d').sum()

I would like to invoke it with a Timedelta since it is easier to arithmetically change the window length:

df.rolling(pd.Timedelta(days=3)).sum()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFrequencyDateOffsetsReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions