Skip to content

ENH: Add VariableForwardWindowIndexer #34226

Closed
@yohplala

Description

@yohplala

Is your feature request related to a problem?

I would like to use the rolling() method with looking-forward window using a negative window.
I don't remember which other pandas function is using this approach of negative window for reversing the position of the window with respect to the actual index, but it is for the user very convenient.
I was convinced it was existing for rolling, but it appears it is not.

Describe the solution you'd like

# Definition of a negative offset (this works)
offset = pd.tseries.frequencies.to_offset('-1h')

# Use it in rolling (this does not work)
start = '2020-01-01 08:00'
end = '2020-01-01 12:00'
intervals = pd.period_range(start = start, end=end, freq = '30T')
values = [i for i in range(0, len(intervals))]
ser = pd.Series(values, index = intervals)
test = ser.rolling(window = offset, closed='left').min()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions