You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: