-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DOC Add more examples to Series.Resample docstring #10628
Conversation
|
||
>>> index = pd.date_range('1/1/2000', periods=9, freq='T') | ||
>>> series = pd.Series(range(9), index=index) | ||
>>> print series |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print
(for py3), only variable name (series
) is better.
Will squash everything into one commit once I add an example of using a custom |
4698949
to
12682db
Compare
@jorisvandenbossche @sinhrks |
Downsample the series into 3 minute bins as above, but label each | ||
bin using the right edge instead of the left. | ||
|
||
>>> series.resample('3T', how='sum', label='right') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you also add how=right'
here as well? (I always find that in most common cases you need to specify both)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorisvandenbossche I'm trying to test some examples with how=right
and I am getting exceptions. What is 'how=right
supposed to do?
series.resample('3T', how='right', label='right')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, sorry, I meant 'closed' instead of 'how'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha no worries! how=right
did seem a bit weird. I'll include closed=right
in the example.
Nice examples! |
Looks nice! No further comments from me. |
@Winterflower Do you have some time to update? (it's only a very small comment) |
@jorisvandenbossche apologies for the delay! I will add the how='right' example tonight after work. |
2011483
to
3b25d52
Compare
Still need to fix line lengths. |
3b25d52
to
3aee25f
Compare
At the moment, the doctest for the string is failing because of the
The solution, based on this is to include the ellipsis in the docstring. Will add that to make the doctests pass.
|
Add more resample examples Improve Series examples Series resample fixes Fixed breaking docstring issue
3aee25f
to
7ee0272
Compare
This is good to go on my part! |
DOC Add more examples to Series.Resample docstring
@Winterflower gr8 thanks! Further I think portions of your narrative my be a nice addition to the actual resample docs; add where appropriate |
Partial fix for #5023
flake8 doesn't do a very good job at checking code in the docstrings for PEP8 compliance, so I'm just eyeballing it at the moment and my PEP8 knowledge leaves something to be desired. Apologies if I missed something really obvious.