Skip to content

Doc: Added docstring to Groupby mean #20910

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 8 commits into from
Jul 7, 2018
Merged

Conversation

cxl923cc
Copy link
Contributor

@cxl923cc cxl923cc commented May 1, 2018

Added examples of the usage and what is returned

@pep8speaks
Copy link

pep8speaks commented May 1, 2018

Hello @cxl923cc! Thanks for updating the PR.

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

Comment last updated on July 07, 2018 at 20:31 Hours UTC

@cxl923cc cxl923cc changed the title Added docstring to Groupby mean Doc: Added docstring to Groupby mean May 1, 2018
@Cheukting
Copy link
Contributor

Thanks for the PR! There is some PEP 8 problem (basically formatting issues) which needed to be fixed. Also you may want to use git diff upstream/master -u -- "*.py" | flake8 --diff to check if there's PEP 8 problem before pushing. Also, you may want to use "DOC: update the pandas.core.groupby.GroupBy.mean docstring" as the PR title so developers knows exactly which method/functions you are updating the docstring.

>>> g
A
1 3.0
2 4.0

Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to put the Example at the end, see https://python-sprints.github.io/pandas/guide/pandas_docstring.html

2 2.0
2 1 3.0
2 5.0

Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to put the Example at the end, see https://python-sprints.github.io/pandas/guide/pandas_docstring.html

@@ -1266,8 +1266,40 @@ def count(self):
def mean(self, *args, **kwargs):
"""
Compute mean of groups, excluding missing values

Copy link
Contributor

Choose a reason for hiding this comment

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

May be you can try adding long summary and Parameters as well, see https://python-sprints.github.io/pandas/guide/pandas_docstring.html

@gfyoung gfyoung added the Docs label May 8, 2018
@codecov
Copy link

codecov bot commented May 8, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@dcbf8b5). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20910   +/-   ##
=========================================
  Coverage          ?   91.82%           
=========================================
  Files             ?      153           
  Lines             ?    49490           
  Branches          ?        0           
=========================================
  Hits              ?    45443           
  Misses            ?     4047           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.22% <100%> (?)
#single 41.85% <77.77%> (?)
Impacted Files Coverage Δ
pandas/core/groupby/groupby.py 92.66% <100%> (ø)

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 dcbf8b5...1eeedd7. Read the comment docs.

@cxl923cc
Copy link
Contributor Author

This is my first pull request. Could someone please help to review the new commit I have made and let me know whether I should make any further change to the Docstring?

@@ -1265,9 +1265,40 @@ def count(self):
@Appender(_doc_template)
def mean(self, *args, **kwargs):
"""
Compute mean of groups, excluding missing values
Compute mean of the target column for groups that are defined by the groupby columns.
Missing values are excluded in computing the mean.
Copy link
Contributor

Choose a reason for hiding this comment

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

blank line here for the Extended Summary

The average of the target column ('B' in the examples below)
grouped by the groupby columns ('A' and ['A', 'C'] in the examples below)

Example of groupby one column:the groups are stored as index in the result.
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use underlines, rather use a blank line

The average of the target column ('B' in the examples below)
grouped by the groupby columns ('A' and ['A', 'C'] in the examples below)

Example of groupby one column:the groups are stored as index in the result.
Copy link
Contributor

Choose a reason for hiding this comment

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

make this a sentence.
Groubpy by one column. The result index are the group labels.

@mroeschke mroeschke added this to the 0.24.0 milestone Jul 7, 2018
@jreback jreback merged commit d01336f into pandas-dev:master Jul 7, 2018
@jreback
Copy link
Contributor

jreback commented Jul 7, 2018

thanks @cxl923cc and @mroeschke for the fixup!

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
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.

6 participants