Skip to content

Not clear which window is default for df.rolling() #17893

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
dstansby opened this issue Oct 16, 2017 · 5 comments · Fixed by #18177
Closed

Not clear which window is default for df.rolling() #17893

dstansby opened this issue Oct 16, 2017 · 5 comments · Fixed by #18177
Labels
Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@dstansby
Copy link
Contributor

The docstring for df.rolling() doesn't say which window is the default (I assume it's boxcar?): https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.DataFrame.rolling.html

@jreback
Copy link
Contributor

jreback commented Oct 16, 2017

the default is None, you must actually specify a win_type for this to have an effect.

@jreback jreback closed this as completed Oct 16, 2017
@jreback
Copy link
Contributor

jreback commented Oct 16, 2017

that said if you want to clarify the doc-string, would be ok.

@dstansby
Copy link
Contributor Author

dstansby commented Oct 16, 2017

The value None is clear as the default, but it doesn't say which window this corresponds to which seems to me to be quite important. (ie. if I pass None, what window does it use?)

@jreback
Copy link
Contributor

jreback commented Oct 16, 2017

@dstansby it doesn't, you must explicity specify. it if you want that 'kind' of window. Full documentation is: http://pandas.pydata.org/pandas-docs/stable/computation.html#rolling-windows

maybe should link to it.

@dstansby
Copy link
Contributor Author

You don't have to explicitly specify it - according to the docs window is an optional keyword argument

import pandas as pd
import numpy as np

ser = pd.Series(np.random.randn(10), index=pd.date_range('1/1/2000', periods=10))

print(ser.rolling(window=5, win_type='boxcar').mean())
print(ser.rolling(window=5, win_type=None).mean())

Both of those print statements give the same thing, which means that win_type=None uses a boxcar window, but reading the docs I don't think there is any way of knowing that.

@jreback jreback added Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Nov 11, 2017
@jreback jreback added this to the No action milestone Nov 11, 2017
@jorisvandenbossche jorisvandenbossche modified the milestones: No action, 0.21.1 Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants