Skip to content

DOC: clarify default window in rolling method #18177

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

Merged
merged 4 commits into from
Nov 30, 2017
Merged

DOC: clarify default window in rolling method #18177

merged 4 commits into from
Nov 30, 2017

Conversation

dstansby
Copy link
Contributor

@dstansby dstansby commented Nov 8, 2017

@codecov
Copy link

codecov bot commented Nov 8, 2017

Codecov Report

Merging #18177 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18177      +/-   ##
==========================================
+ Coverage    91.4%   91.41%   +<.01%     
==========================================
  Files         163      163              
  Lines       50068    50068              
==========================================
+ Hits        45764    45768       +4     
+ Misses       4304     4300       -4
Flag Coverage Δ
#multiple 89.22% <ø> (+0.02%) ⬆️
#single 40.35% <ø> (-0.05%) ⬇️
Impacted Files Coverage Δ
pandas/core/window.py 96.37% <ø> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.8% <0%> (-0.1%) ⬇️
pandas/core/groupby.py 92.02% <0%> (-0.02%) ⬇️
pandas/plotting/_tools.py 72.92% <0%> (ø) ⬆️
pandas/compat/__init__.py 58.1% <0%> (ø) ⬆️
pandas/core/config_init.py 98.34% <0%> (ø) ⬆️
pandas/io/parquet.py 65.38% <0%> (ø) ⬆️
pandas/plotting/_style.py 74.28% <0%> (ø) ⬆️
pandas/io/msgpack/_version.py 44.65% <0%> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8aad92...7085458. Read the comment docs.

@@ -503,6 +503,7 @@ class Window(_Window):
* ``general_gaussian`` (needs power, width)
* ``slepian`` (needs width).

If ``win_type=None`` a boxcar window is used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add this, I think we should explain what a boxcar window is (as now in the default case the user does not need to worry about it, and those assuming you just get a uniform hard-cut window are correct)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come to think of it, none of the other windows are explained either! Are the windows used custom pandas ones, or are they just the normal numpy ones? And if they're pandas ones do they have their own bit of documentation to link to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are all scipy windows
certainly take links to that documentation (in doc string and in computation.rst)

@dstansby
Copy link
Contributor Author

dstansby commented Nov 9, 2017

I've added a link to the scipy docs - I presumed this is where all the windows come from?

@@ -503,6 +503,9 @@ class Window(_Window):
* ``general_gaussian`` (needs power, width)
* ``slepian`` (needs width).

If ``win_type=None`` a boxcar window is used. To learn more about different
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct, the default is in fact win_type=None, which means your window is specified by the the window parameters; only if you actually specify a win_type do you get a specific weighted window.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fundamentally doing a rolling window calculation involves choosing a window, so what window does passing win_type=None choose? I thought it was a boxcar?

Is it valid to specify both the window parameters and the window type, or can only one be provided?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most operations are an u weighted window
only if you specify win_type do you get a special weighted window (which also has only sum/mean) methods (this is not very common usage, not using win_type is by far the most common)

i think the docs in computation are pretty clear in this

certainly could add more / better examples in the doc string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so if you don't specify win_type you get an un-weighted window, which is a boxcar window, which is what my addition says.

I disagree that the docs are pretty clear, and I think this helps clear them up. (I also think it doesn't confuse anything, and I'm 99% sure what I've written is correct!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the current default uniform unweighted window is apparently a boxcar window (which I only learned by looking up what a boxcar window is).
I think that I am not alone in that, therefore I would change the explanation slightly to first explain what the default window is, and then only to say that this is called a boxcar window (people should certainly not need to follow a link to know what the meaning of the default is IMO)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I understand the confusion now - I don't have time now, but will try and revise later.

@dstansby
Copy link
Contributor Author

Is this a bit better?

@jreback jreback added this to the 0.21.1 milestone Nov 11, 2017
@jreback
Copy link
Contributor

jreback commented Nov 11, 2017

seems ok to me, @jorisvandenbossche

@jreback
Copy link
Contributor

jreback commented Nov 22, 2017

@jorisvandenbossche

@jorisvandenbossche jorisvandenbossche changed the title Clarify default window in rolling() DOC: clarify default window in rolling method Nov 30, 2017
@jorisvandenbossche jorisvandenbossche merged commit c40c8f8 into pandas-dev:master Nov 30, 2017
@jorisvandenbossche
Copy link
Member

@dstansby Thanks a lot!

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Dec 8, 2017
TomAugspurger pushed a commit that referenced this pull request Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not clear which window is default for df.rolling()
3 participants