Skip to content

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

Merged
merged 2 commits into from
Oct 21, 2017

Conversation

reidy-p
Copy link
Contributor

@reidy-p reidy-p commented Oct 19, 2017

@codecov
Copy link

codecov bot commented Oct 20, 2017

Codecov Report

Merging #17925 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 89.03% <ø> (ø) ⬆️
#single 40.31% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 92.53% <ø> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/core/ops.py 91.77% <0%> (+0.01%) ⬆️

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 51c5f4d...c29db45. Read the comment docs.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a 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" ?


.. ipython:: python

ts.truncate(before='10/31/2011', after='12/31/2011')
ts.truncate(before='2011', after='2012')
Copy link
Member

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 ?

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
Copy link
Member

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

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')
Copy link
Member

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

@jreback jreback added this to the 0.21.0 milestone Oct 21, 2017
@jreback jreback merged commit 95b422c into pandas-dev:master Oct 21, 2017
@jreback
Copy link
Contributor

jreback commented Oct 21, 2017

thanks @reidy-p

peterpanmj pushed a commit to peterpanmj/pandas that referenced this pull request Oct 31, 2017
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
@reidy-p reidy-p deleted the truncate_examples branch November 27, 2017 14:48
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 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.

DateFrame.truncate is not equivalent to slicing as mentioned in docs
3 participants