Skip to content

BUG: rolling_window yields unexpected results with win_type='triang' #7618

Closed
@AllenDowney

Description

@AllenDowney

Here's the example in the documentation, modified to have non-zero mean:

n = 100
ser = pandas.Series(randn(n)+10, index=pandas.date_range('1/1/2000', periods=n))
pandas.rolling_window(ser, 5, 'triang').plot()
pandas.rolling_window(ser, 5, 'boxcar').plot()

The rolling boxcar window is centered around 10, as expected.

The triang window is centered around 6. That suggests that the weights in the window don't add up to 1.

Either that or my expectation of how it should work is wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions