Skip to content
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

DOC: Fix quotes position in pandas.core #24071

Closed
datapythonista opened this issue Dec 3, 2018 · 22 comments · Fixed by #26526
Closed

DOC: Fix quotes position in pandas.core #24071

datapythonista opened this issue Dec 3, 2018 · 22 comments · Fixed by #26526
Labels
Code Style Code style, linting, code_checks Docs good first issue
Milestone

Comments

@datapythonista
Copy link
Member

To keep out docstrings consistent, and make them easier to read, we try to keep always the same exact format. In the case of the opening and closing quotes, the right format is:

def foo():
    """
    Summary of the docstring.

    Returns
    -------
    str
        Explaining what is being returned.
    """

But for historical reasons, we have many docstrings with different format, for example:

def foo():
    """Summary of the docstring.

    Returns
    -------
    str
        Explaining what is being returned."""

Besides being inconsistent, having docstrings with the wrong format doesn't let us start validating and enforcing automatically the wanted format. So, we need to change all the wrong cases.

For this issue, all the wrong cases of methods of pandas.core should be fixed. The list can be obtained with the next command (the command should not report any error when this is fixed):

$ ./scripts/validate_docstrings.py --prefix=pandas.core --errors=GL01,GL02
pandas.core.window.Rolling.skew: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.window.Expanding.skew: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.aggregate: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.aggregate: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.GroupBy.transform: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.transform: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.GroupBy.pipe: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.first: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.last: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.max: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.min: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.prod: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.sum: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.corr: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.corr: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.count: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.count: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.cov: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.cov: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.diff: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.diff: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.fillna: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.fillna: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.hist: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.hist: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.idxmax: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.idxmax: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.idxmin: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.idxmin: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.mad: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.mad: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.quantile: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.quantile: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.skew: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.skew: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.take: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.take: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.tshift: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.tshift: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.nlargest: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.nlargest: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.nsmallest: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.nsmallest: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.nunique: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.nunique: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.unique: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.unique: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.value_counts: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.value_counts: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.groupby.DataFrameGroupBy.corrwith: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.DataFrameGroupBy.corrwith: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.resample.Resampler.pipe: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.nunique: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.nunique: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.core.resample.Resampler.first: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.last: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.max: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.min: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.prod: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.resample.Resampler.sum: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
@giantpanpan
Copy link

Hi @datapythonista Can I work on this issue?

@datapythonista
Copy link
Member Author

Absolutely, let me know if you need help. Thanks @giantpanpan

@giantpanpan
Copy link

@datapythonista Thank you!

@giantpanpan
Copy link

Hi @datapythonista I have one question is that when I was reading the contributing instruction, it ask us to install the dependencies using the following command. However, I found that the file "ci/environment-dev.yaml" and "ci/requirements-optional-conda.txt" no longer exist in the ./ci dir.
Are they moved to other dir? Thank you!

image

@datapythonista
Copy link
Member Author

We updated that document, but you're checking the documentation of the last stable release (which makes sense, but in this case is outdated).

Once you have conda set up, from the pandas project root, you need to simply run conda env create. And after it's created activate the environment with source activate pandas-dev (not sure if in windows is conda activate pandas-dev).

@giantpanpan
Copy link

@datapythonista I see! Thanks!

@datapythonista
Copy link
Member Author

this is the latest version of the contributing page: https://pandas-docs.github.io/pandas-docs-travis/contributing.html

giantpanpan added a commit to giantpanpan/pandas that referenced this issue Dec 6, 2018
@LJArendse
Copy link
Contributor

@datapythonista is it okay if I pick up this issue?

@datapythonista
Copy link
Member Author

@giantpanpan is already working on it. Can you look for an issue that nobody mentioned in the comments that is working on it, or that did it more than 2 weeks ago, but didn't finally work on it?

If you don't find anything, let me know, I'll open some more "good first issue"

@LJArendse
Copy link
Contributor

@datapythonista awesome, will do, thanks

@datapythonista
Copy link
Member Author

@giantpanpan are you still working on this?

@iam-mhaseeb
Copy link

@datapythonista Anyone working on it? If no one is working I can work on it.

@datapythonista
Copy link
Member Author

go ahead, thank you!

@iam-mhaseeb
Copy link

Okay. I'm working on it.

@clham
Copy link
Contributor

clham commented Feb 24, 2019

It looks like there are bunch of these left. I'm having some difficulty figuring this out: in the case where the doc ends with something touched by @substitution that ends in a new line, the new-lines in the main doc, and the substitution both "stay", and cause the raw_doc to end in a double new-line (causing the validation to fail). An example is

%(examples)s

What's the desired outcome on this edge?

@marcusschimizzi
Copy link

This hasn't been active for a couple of months, so what's the status with this issue? Is there still work to be done?

@alexcwatt
Copy link
Contributor

@schimizzimj I think a couple docstrings were overlooked but I've just opened a PR which should close this out.

@jreback jreback added this to the 0.25.0 milestone Apr 10, 2019
alexcwatt added a commit to alexcwatt/pandas that referenced this issue Apr 27, 2019
@jreback jreback removed this from the 0.25.0 milestone May 12, 2019
@jreback jreback added this to the Contributions Welcome milestone May 12, 2019
@c0dr7
Copy link

c0dr7 commented May 14, 2019

I am noobie and this looks like an easy tast to start but I would like some guidance maybe there is a noobie instructor that can point in the steps so I can start working on this?

I have followed the noobie tutorial on git clone commit status and push I need a specific in this case how to work on this

ok so now I have installed all the dependences

@datapythonista
Copy link
Member Author

Thanks for volunteering @c0dr7

You can take a look at #26037, and continue from there. Check the comments from the review to see what was incomplete, missing or wrong.

The general idea is to replace cases like:

def foo():
    """Compute count of group, excluding missing values"""
    pass

by:

def foo():
    """
    Compute count of group, excluding missing values
    """
    pass

But in some cases the docstrings are generated dynamically and it's trickier. Feel free to send a partial PR with the easy cases, and leave the more complex for a second PR.

@abdur-n-tr
Copy link

@datapythonista I am newbie to open source contribution but not in pandas. I have successfully setup an environment locally using pandas contribution docs. I am not seeing any good first issue on which no one is working. Can you please refer me to some good first issue? Excited to hear from you soon.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented May 16, 2019 via email

@killerontherun1
Copy link
Contributor

Hey,

Newbie, again. I setup the environment and I think I have the latest version.

I ran:
./scripts/validate_docstrings.py --prefix=pandas.core --errors=GL01,GL02

Output:
pandas.core.resample.Resampler.pipe: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.pipe: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.core.groupby.GroupBy.pipe: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)

I'm going to go ahead and correct these and submit a PR for the same.

PS: I'm looking for someone to correct me if I'm wrong in submitting my first PR. Thanks.

@jreback jreback modified the milestones: Contributions Welcome, 0.25.0 Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment