Skip to content

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

Merged
merged 2 commits into from
Mar 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6888,29 +6888,33 @@ def tshift(self, periods=1, freq=None, axis=0):

def truncate(self, before=None, after=None, axis=None, copy=True):
"""
Truncates a sorted DataFrame/Series before and/or after some
particular index value. If the axis contains only datetime values,
Truncate a DataFrame/Series before/after some index value.

If the axis contains only datetime values,
before/after parameters are converted to datetime values.

Parameters
----------
before : date, string, int
Truncate all rows before this index value
Truncate all rows before this index value.
after : date, string, int
Truncate all rows after this index value
Truncate all rows after this index value.
axis : {0 or 'index', 1 or 'columns'}

* 0 or 'index': apply truncation to rows
* 1 or 'columns': apply truncation to columns
Copy link
Member

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.


Default is stat axis for given data type (0 for Series and
DataFrames, 1 for Panels)
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done thanks!

DataFrames).
copy : boolean, default is True,
return a copy of the truncated section
Return a copy of the truncated section.

Returns
-------
truncated : type of caller
type of caller
The truncated DataFrame/Series.

See Also
--------
DataFrame.truncate : Truncate a DataFrame before/after some index
Copy link
Contributor

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

Copy link
Member

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")

value.
Series.truncate : Truncate a Series before/after some index value.

Examples
--------
Expand Down