Skip to content

BUG: expanding/rolling_apply() interpret min_periods=0 as min_periods=1 #8080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
seth-p opened this issue Aug 20, 2014 · 0 comments · Fixed by #8059
Closed

BUG: expanding/rolling_apply() interpret min_periods=0 as min_periods=1 #8080

seth-p opened this issue Aug 20, 2014 · 0 comments · Fixed by #8059

Comments

@seth-p
Copy link
Contributor

seth-p commented Aug 20, 2014

expanding/rolling_apply() interpret min_periods=0 as min_periods=1. This is usually ok, as almost every function will return NaN when the inputs are all NaN. However, this is not true, for example, of functions like len().

For example, I think that in the following calls, the results should be 1, 2, 2 and 1, 2, 3, respectively.

In [409]: rolling_apply(Series([None, None, None]), 2, lambda x: len(x), min_periods=0)
Out[409]:
0   NaN
1   NaN
2   NaN
dtype: float64

In [411]: expanding_apply(Series([None, None, None]), lambda x: len(x), min_periods=0)
Out[411]:
0   NaN
1   NaN
2   NaN
dtype: float64
@seth-p seth-p changed the title BUG: expanding/rolling_apply() with min_periods=0 BUG: expanding/rolling_apply() interpret min_periods=0 as min_periods=1 Aug 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant