Skip to content

Rolling with win_type='triang' strange results #22268

Closed
@WangWenQiang

Description

@WangWenQiang

in my env(mac, python3.6.1,pandas0.23.4)

In [26]: df = pd.DataFrame({'B': [0, 1, 2, np.nan, 4]})
In [27]: df
Out[27]:
B
0 0.0
1 1.0
2 2.0
3 NaN
4 4.0

In [28]: df.rolling(2, win_type='triang').sum()
Out[28]:
B
0 NaN
1 0.5
2 1.5
3 NaN
4 NaN

In [29]: df.rolling(2, win_type='triang').mean()
Out[29]:
B
0 NaN
1 0.5
2 1.5
3 NaN
4 NaN

but in the docs,

df.rolling(2, win_type='triang').sum()
B
0 NaN
1 1.0
2 2.5
3 NaN
4 NaN

q1: docs.sum and myenv.sum is different
q2:sum()'result is the same as means()'result

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffBugWindowrolling, ewma, expanding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions