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

Conversation

schopra6
Copy link
Contributor

@schopra6 schopra6 commented Mar 10, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

################################################################################
################### Docstring (pandas.Series.str.rpartition) ###################
################################################################################

Split the string at the last occurrence of `sep`.

This method splits the string at the last occurrence of `sep`,
and return 3 elements containing the part before the separator,
the separator itself, and the part after the separator.
If the separator is not found, return 3 elements containing two empty strings, followed by the string itself.

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.

Returns
-------
split : DataFrame/MultiIndex or Series/Index of objects

See Also
--------
partition : Split the string at the first occurrence of `sep`

Examples
--------

>>> s = pd.Series(['A_B_C', 'D_E_F', 'X'])
>>> s
0    A_B_C
1    D_E_F
2        X
dtype: object

>>> s.str.partition('_')
   0  1    2
0  A  _  B_C
1  D  _  E_F
2  X

>>> s.str.rpartition('_')
     0  1  2
0  A_B  _  C
1  D_E  _  F
2          X

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.Series.str.rpartition" correct. :)

If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.

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"

@@ -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.

@jreback jreback added Docs Strings String extension data type and string data labels Mar 11, 2018
@jorisvandenbossche
Copy link
Member

@darke-spirits do you have time do update the PR based on the feedback?

@datapythonista datapythonista self-assigned this Jul 8, 2018
@codecov
Copy link

codecov bot commented Jul 8, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20199      +/-   ##
==========================================
- Coverage    91.9%   91.72%   -0.18%     
==========================================
  Files         160      150      -10     
  Lines       49904    49152     -752     
==========================================
- Hits        45864    45086     -778     
- Misses       4040     4066      +26
Flag Coverage Δ
#multiple 90.11% <ø> (-0.18%) ⬇️
#single 41.84% <ø> (-0.26%) ⬇️
Impacted Files Coverage Δ
pandas/core/strings.py 98.32% <ø> (-0.31%) ⬇️
pandas/plotting/_compat.py 62% <0%> (-28.91%) ⬇️
pandas/io/s3.py 72.72% <0%> (-13.64%) ⬇️
pandas/core/arrays/base.py 74.35% <0%> (-13.5%) ⬇️
pandas/io/formats/terminal.py 16.43% <0%> (-4.55%) ⬇️
pandas/io/formats/printing.py 89.38% <0%> (-3.71%) ⬇️
pandas/io/html.py 86.6% <0%> (-2.57%) ⬇️
pandas/io/formats/format.py 96.26% <0%> (-1.99%) ⬇️
pandas/io/common.py 68.77% <0%> (-1.88%) ⬇️
pandas/core/indexes/period.py 92.61% <0%> (-1.8%) ⬇️
... and 81 more

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 6008d75...8d5ef6e. Read the comment docs.

@datapythonista datapythonista merged commit 9e1f6fd into pandas-dev:master Jul 8, 2018
@datapythonista
Copy link
Member

Thanks @darke-spirits for the contribution!

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
…das-dev#20199)

* rpartition docstring is modified

* rpartition docstring is modified

* Fixing couple of typos, and improving the See Also and Examples section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants