Skip to content

BUG: rolling count does not respect the default behavior of min_periods #35972

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
3 tasks done
mroeschke opened this issue Aug 29, 2020 · 1 comment
Closed
3 tasks done
Labels
Bug Window rolling, ewma, expanding

Comments

@mroeschke
Copy link
Member

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.

Per the documentation:

For a window that is specified by an offset, min_periods will default to 1. Otherwise, min_periods will default to the size of the window.

Therefore these two statements should be equal

In [4]: pd.__version__
Out[4]: '1.2.0.dev0+160.gd90b73bde'

In [5]: pd.Series([np.nan] * 4).rolling(2).count()
Out[5]:
0    0.0
1    0.0
2    0.0
3    0.0
dtype: float64

In [6]: pd.Series([np.nan] * 4).rolling(2, min_periods=2).count()
Out[6]:
0    NaN
1    0.0
2    0.0
3    0.0
dtype: float64
@mroeschke mroeschke added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 29, 2020
@mroeschke mroeschke changed the title BUG: rolling count does not the default behavior of min_periods BUG: rolling count does not respect the default behavior of min_periods Aug 29, 2020
@mroeschke mroeschke added Window rolling, ewma, expanding and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 29, 2020
@mroeschke
Copy link
Member Author

Duplicate of #31302

@mroeschke mroeschke marked this as a duplicate of #31302 Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Window rolling, ewma, expanding
Projects
None yet
Development

No branches or pull requests

1 participant