-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
DOC: Improved the docstring of pandas.Series.truncate #20125
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: Improved the docstring of pandas.Series.truncate #20125
Conversation
|
Hello @simobasso! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 15, 2018 at 21:27 Hours UTC |
37bf639 to
2763ae4
Compare
pandas/core/generic.py
Outdated
| Returns | ||
| ------- | ||
| truncated : type of caller |
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.
If function returns a single value, name is no necessary.
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.
It should be, for example:
Returns
-------
type of caller
The truncated DataFrame/Series.
pandas/core/generic.py
Outdated
| See Also | ||
| -------- | ||
| DataFrame.truncate : | ||
| Truncate a DataFrame before/after some index value. |
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.
Description must start in the same line:
DataFrame.truncate : Truncate a DataFrame before/after some index value.
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.
If more than 80 chars:
DataFrame.truncate : Truncate a DataFrame before/after some index
value.
|
@arnau126 thanks for review! |
2763ae4 to
5471ca3
Compare
| * 1 or 'columns': apply truncation to columns | ||
| Default is stat axis for given data type (0 for Series and | ||
| DataFrames, 1 for Panels) |
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.
you can remove the default for Panel
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.
done thanks!
5471ca3 to
f68b9af
Compare
pandas/core/generic.py
Outdated
| See Also | ||
| -------- | ||
| DataFrame.truncate : Truncate a DataFrame before/after some index |
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.
we don't have these defined in Series/DataFrame, so not sure these can be here @jorisvandenbossche
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.
Yes, since the docstring is shared for both Series and DataFrame, those "see also" are referring to themselves. So indeed not needed in this case (and you ignore the error in the validation script about missing "See Also")
| axis : {0 or 'index', 1 or 'columns'} | ||
| * 0 or 'index': apply truncation to rows | ||
| * 1 or 'columns': apply truncation to columns |
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.
I think this list was still informative? So I would keep it.
pandas/core/generic.py
Outdated
| See Also | ||
| -------- | ||
| DataFrame.truncate : Truncate a DataFrame before/after some index |
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.
Yes, since the docstring is shared for both Series and DataFrame, those "see also" are referring to themselves. So indeed not needed in this case (and you ignore the error in the validation script about missing "See Also")
* reword summaries * standard `axis` * show df * added series * reword datetime coercion [ci skip]
Codecov Report
@@ Coverage Diff @@
## master #20125 +/- ##
=========================================
Coverage ? 91.72%
=========================================
Files ? 150
Lines ? 49152
Branches ? 0
=========================================
Hits ? 45086
Misses ? 4066
Partials ? 0
Continue to review full report at Codecov.
|
TomAugspurger
left a comment
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.
Updated.
I think the original doc for axis was wrong. rows is always truncated by default (which makes more sense to me). See the examples.
|
@simobasso Thanks for the PR! |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>git diff upstream/master -u -- "*.py" | flake8 --diffpython doc/make.py --single <your-function-or-method>Please include the output of the validation script below between the "```" ticks: