Skip to content

DOC: Capitalize docstring summaries of Series #23647

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 16 commits into from
Nov 21, 2018
Merged

Conversation

avolkov
Copy link
Contributor

@avolkov avolkov commented Nov 12, 2018

Updated documentation to resolve SS02 errors in pandas.Series

@pep8speaks
Copy link

pep8speaks commented Nov 12, 2018

Hello @avolkov! Thanks for updating the PR.

Comment last updated on November 20, 2018 at 16:35 Hours UTC

@datapythonista
Copy link
Member

Nice work, thanks @avolkov

Do you mind taking care in this PR or the next issue in the same docstrings you fixed:

We have this in many cases:

def foo():
    """ Returns whatever is computed """

But the right formatting would be:

def foo():
    """
    Returns whatever is computed.
    """

Besides the capital letter:

  • The summary should be in the next line than the initial """
  • The first word, if a verb shouldn't be Returns (third-person) but Return the infinitive
  • The Summary should finish with a period
    -The closing quotes go to the next line

Sorry I didn't see that was wrong in these same docstrings, but if you can fix this here, that would be really great.

@avolkov
Copy link
Contributor Author

avolkov commented Nov 12, 2018

@datapythonista

Sure, I've noticed some of these strings were inconsistent.

I'll update current PR with fixes.

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.

Thanks @avolkov much better now. I added few missing periods that you should be able to accept just with a click. Happy to merge after that.

datapythonista and others added 4 commits November 13, 2018 11:12
Co-Authored-By: avolkov <alex@flamy.ca>
Co-Authored-By: avolkov <alex@flamy.ca>
Co-Authored-By: avolkov <alex@flamy.ca>
Co-Authored-By: avolkov <alex@flamy.ca>
@datapythonista
Copy link
Member

Can you merge master into your branch @avolkov. Not sure why the CI was cancelled for this PR, but that should trigger a new run.

@datapythonista
Copy link
Member

Still no luck with the CI, can you merge master again please

@avolkov
Copy link
Contributor Author

avolkov commented Nov 15, 2018

I was sure something was wrong in master. If that doesn't work and re-run tests locally cherry-picking the changes.

@datapythonista
Copy link
Member

@avolkov just realized that we have a test that it's checking the text in a docstring. That's what is making the CI fail. Can you take a look and fix it please?

This is what it's failing I think: pandas/tests/series/test_internals.py:320

    def test_hasnans_unchached_for_series():
        # GH#19700
        idx = pd.Index([0, 1])
        assert idx.hasnans is False
        assert 'hasnans' in idx._cache
        ser = idx.to_series()
        assert ser.hasnans is False
        assert not hasattr(ser, '_cache')
        ser.iloc[-1] = np.nan
        assert ser.hasnans is True
>       assert Series.hasnans.__doc__ == pd.Index.hasnans.__doc__
E       AssertionError: assert '\n        Re...ps.\n        ' == ' return if I ...erf speedups '
E         - 
E         -         Return if I have any nans; enables various perf speedups.
E         ?  ^^^^^^^^                                                       ^^
E         +  return if I have any nans; enables various perf speedups 
E         ?  ^                                                       ^
E         -

@datapythonista
Copy link
Member

@avolkov can you fix the error in travis please:

./pandas/core/base.py:705:80: E501 line too long (80 > 79 characters)

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.

Looks great, thank you @avolkov

@codecov
Copy link

codecov bot commented Nov 20, 2018

Codecov Report

Merging #23647 into master will increase coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23647      +/-   ##
==========================================
+ Coverage   92.24%   92.28%   +0.03%     
==========================================
  Files         161      161              
  Lines       51339    51461     +122     
==========================================
+ Hits        47360    47493     +133     
+ Misses       3979     3968      -11
Flag Coverage Δ
#multiple 90.68% <66.66%> (+0.04%) ⬆️
#single 42.31% <66.66%> (-0.04%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/datetimelike.py 97.74% <ø> (ø) ⬆️
pandas/core/series.py 93.68% <ø> (ø) ⬆️
pandas/core/arrays/sparse.py 91.94% <ø> (+0.12%) ⬆️
pandas/core/generic.py 96.84% <ø> (+0.01%) ⬆️
pandas/core/base.py 97.61% <100%> (ø) ⬆️
pandas/core/indexes/base.py 96.48% <50%> (+0.02%) ⬆️
pandas/core/arrays/datetimelike.py 95.96% <0%> (-0.19%) ⬇️
pandas/io/formats/format.py 97.76% <0%> (-0.13%) ⬇️
pandas/util/testing.py 86.04% <0%> (-0.04%) ⬇️
pandas/core/arrays/integer.py 95.47% <0%> (-0.02%) ⬇️
... and 42 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 b4b945a...41a7ef5. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Nov 21, 2018
@jreback jreback merged commit 485e7cd into pandas-dev:master Nov 21, 2018
@jreback
Copy link
Contributor

jreback commented Nov 21, 2018

thanks!

Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Capitalize docstring summaries of Series
4 participants