Skip to content

DOC: Improving the docstring of Series.str.upper and related #20462

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 4 commits into from
Mar 28, 2018

Conversation

Hamishpk
Copy link
Contributor

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.upper)  #####################
################################################################################

Convert strings in the Series/Index to uppercase.

Equivalent to :meth:`str.upper`.

Returns
-------
Series/Index of objects

See Also
--------
Series.str.lower : Converts all characters to lower case.
Series.str.upper : Converts all characters to upper case.
Series.str.title : Converts first character of each word to upper case and
    remaining to lower case.
Series.str.capitalize : Converts first character to upper case and
    remaining to lower case.
Series.str.swapcase : Converts upper case to lower case and lower case to
    upper case.

Examples
--------
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s.str.lower()
0                 lower
1              capitals
2    this is a sentence
3              swapcase
dtype: object

>>> s.str.upper()
0                 LOWER
1              CAPITALS
2    THIS IS A SENTENCE
3              SWAPCASE
dtype: object

>>> s.str.title()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: object

>>> s.str.capitalize()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: object

>>> s.str.swapcase()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: object

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

Docstring for "pandas.Series.str.upper" 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.

Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@codecov
Copy link

codecov bot commented Mar 23, 2018

Codecov Report

Merging #20462 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20462      +/-   ##
==========================================
+ Coverage   91.82%   91.85%   +0.02%     
==========================================
  Files         152      152              
  Lines       49248    49231      -17     
==========================================
- Hits        45222    45220       -2     
+ Misses       4026     4011      -15
Flag Coverage Δ
#multiple 90.23% <ø> (+0.02%) ⬆️
#single 41.83% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/core/strings.py 98.32% <ø> (ø) ⬆️
pandas/core/arrays/base.py 83.33% <0%> (-0.82%) ⬇️
pandas/core/algorithms.py 94.29% <0%> (-0.07%) ⬇️
pandas/core/base.py 96.78% <0%> (-0.01%) ⬇️
pandas/core/indexes/base.py 96.68% <0%> (-0.01%) ⬇️
pandas/core/frame.py 97.18% <0%> (-0.01%) ⬇️
pandas/core/dtypes/missing.py 91.07% <0%> (ø) ⬆️
pandas/core/generic.py 95.85% <0%> (ø) ⬆️
pandas/core/reshape/reshape.py 100% <0%> (ø) ⬆️
... and 6 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 cdfce2b...5dcb7d1. Read the comment docs.

Examples
--------
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s.str.lower()
Copy link
Member

Choose a reason for hiding this comment

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

Could you show the original s, (simply with a line >>> s and its output). And then leave a blank line between it and the lower method, so the lower doesn't get grouped with the constructor and the original, but in a separate block as the rest?

Besides that, lgtm.


See Also
--------
Series.str.lower : Converts all characters to lower case.
Copy link
Member

Choose a reason for hiding this comment

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

"lower case" -> "lowercase" ?
Or at least we should be consistent with what is substituted in the summary line (currently this is "lowercase")

@pep8speaks
Copy link

pep8speaks commented Mar 24, 2018

Hello @Hamishpk! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on March 24, 2018 at 12:57 Hours UTC

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

lgtm

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 28, 2018
@TomAugspurger
Copy link
Contributor

Fixed the doctest.

thanks @Hamishpk

@TomAugspurger TomAugspurger merged commit f5cfee7 into pandas-dev:master Mar 28, 2018
javadnoorb pushed a commit to javadnoorb/pandas that referenced this pull request Mar 29, 2018
dworvos pushed a commit to dworvos/pandas that referenced this pull request Apr 2, 2018
kornilova203 pushed a commit to kornilova203/pandas that referenced this pull request Apr 23, 2018
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.

5 participants