-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Description
I ran into a minor gotcha with the rolling_* methods, below is some ipython output to illustrate.
I set min_periods to 0, which in retrospect i realize is not a reasonable value, but i would either
expect the same behavior as min_periods=1 or maybe an error. For rolling_max, the issue is
with line 421 in moments.pyx:
"for i from minp - 1 <= i < N:"
so if minp==0 then the first value of i = -1, which will wreak all kinds of havoc.
In [10]: df
Out[10]:
0
0 7
1 9
2 8
3 20
In [11]: pandas.rolling_max(df,window=df.shape[0],min_periods=0)
Out[11]:
0
0 20
1 20
2 20
3 20
In [12]: pandas.rolling_max(df,window=df.shape[0],min_periods=1)
Out[12]:
0
0 7
1 9
2 9
3 20
Metadata
Metadata
Assignees
Labels
No labels