Skip to content

DOC: update the pandas.Series.str.rpartition() docstring (Delhi) #20199

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 5 commits into from
Jul 8, 2018
Merged
Changes from 3 commits
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
15 changes: 9 additions & 6 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1611,18 +1611,20 @@ def rsplit(self, pat=None, n=-1, expand=False):
return self._wrap_result(result, expand=expand)

_shared_docs['str_partition'] = ("""
Split the string at the %(side)s occurrence of `sep`, and return 3 elements
containing the part before the separator, the separator itself,
and the part after the separator.
Split the string at the %(side)s occurrence of `sep`.

This method splits the string at the %(side)s occurrence of `sep`,
and return 3 elements containing the part before the separator,
Copy link
Contributor

Choose a reason for hiding this comment

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

"return" -> "returns"

the separator itself, and the part after the separator.
If the separator is not found, return %(return)s.

Parameters
----------
pat : string, default whitespace
String to split on.
expand : bool, default True
* If True, return DataFrame/MultiIndex expanding dimensionality.
* If False, return Series/Index.
If True, return DataFrame/MultiIndex expanding dimensionality.
If False, return Series/Index.

Returns
-------
Expand All @@ -1635,7 +1637,8 @@ def rsplit(self, pat=None, n=-1, expand=False):
Examples
--------

>>> s = Series(['A_B_C', 'D_E_F', 'X'])
>>> s = pd.Series(['A_B_C', 'D_E_F', 'X'])
Copy link
Contributor

Choose a reason for hiding this comment

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

This docstring is shared with the Index. Could you add a short example with Index as well? (can be the same data as this one, just in Index instead of Series.

>>> s
0 A_B_C
1 D_E_F
2 X
Expand Down