-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Conversation
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 |
Thanks for the PR! There is some PEP 8 problem (basically formatting issues) which needed to be fixed. Also you may want to use |
pandas/core/groupby/groupby.py
Outdated
>>> g | ||
A | ||
1 3.0 | ||
2 4.0 | ||
|
There was a problem hiding this comment.
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
pandas/core/groupby/groupby.py
Outdated
2 2.0 | ||
2 1 3.0 | ||
2 5.0 | ||
|
There was a problem hiding this comment.
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
pandas/core/groupby/groupby.py
Outdated
@@ -1266,8 +1266,40 @@ def count(self): | |||
def mean(self, *args, **kwargs): | |||
""" | |||
Compute mean of groups, excluding missing values | |||
|
There was a problem hiding this comment.
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
Codecov Report
@@ Coverage Diff @@
## master #20910 +/- ##
=========================================
Coverage ? 91.82%
=========================================
Files ? 153
Lines ? 49490
Branches ? 0
=========================================
Hits ? 45443
Misses ? 4047
Partials ? 0
Continue to review full report at Codecov.
|
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? |
pandas/core/groupby/groupby.py
Outdated
@@ -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. |
There was a problem hiding this comment.
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
pandas/core/groupby/groupby.py
Outdated
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. |
There was a problem hiding this comment.
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
pandas/core/groupby/groupby.py
Outdated
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. |
There was a problem hiding this comment.
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.
…ples. Changed dashlines to blank lines.
thanks @cxl923cc and @mroeschke for the fixup! |
Added examples of the usage and what is returned