-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improve truncate docstring (#17763) #17925
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
Conversation
reidy-p
commented
Oct 19, 2017
- closes DateFrame.truncate is not equivalent to slicing as mentioned in docs #17763
Codecov Report
@@ Coverage Diff @@
## master #17925 +/- ##
==========================================
- Coverage 91.23% 91.22% -0.02%
==========================================
Files 163 163
Lines 50112 50113 +1
==========================================
- Hits 45722 45714 -8
- Misses 4390 4399 +9
Continue to review full report at Codecov.
|
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.
Thanks! Added a few comments.
In the docstring of truncate
, can you also edit the first line of the docstring to replace 'NDFrame' with "DataFrame/Series" ?
doc/source/timeseries.rst
Outdated
|
||
.. ipython:: python | ||
|
||
ts.truncate(before='10/31/2011', after='12/31/2011') | ||
ts.truncate(before='2011', after='2012') |
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 add the equivalent slicing example as well to show it is not the same ?
pandas/core/generic.py
Outdated
axis : {0 or 'index', 1 or 'columns'} | ||
* 0 or 'index': apply truncation to rows | ||
* 1 or 'columns': apply truncation to columns | ||
Default is stat axis for given data type (0 for Series and |
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.
blank line above this one
pandas/core/generic.py
Outdated
date component in a ``DatetimeIndex`` in contrast to slicing which | ||
returns any partially matching dates. | ||
|
||
>>> dates = pd.date_range('2016-1-1', '2016-2-1', freq='s') |
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.
nitpick: I prefer to use iso dates in our docs (apart for examples specifically on date string parsing), so "2016-01-01" etc
thanks @reidy-p |