BUG: rolling_window yields unexpected results with win_type='triang' · Issue #7618 · pandas-dev/pandas (original) (raw)

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?