-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the DataFrame.mode method docstring #20241
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 @mkoo21! Thanks for updating the PR.
Comment last updated on March 11, 2018 at 21:14 Hours UTC |
@mkoo21 Can you try to follow the guidelines please? Check for PEP8, paste the output of the validation script |
Sorry, I thought I ran the PEP8 check but it wasn't outputting anything when I ran it earlier.
|
pandas/core/frame.py
Outdated
@@ -111,9 +111,9 @@ | |||
by : str or list of str | |||
Name or list of names to sort by. | |||
|
|||
- if `axis` is 0 or `'index'` then `by` may contain index | |||
- if ``axis`` is 0 or ``'index'`` then `by` may contain index | |||
levels and/or column labels |
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.
try not to change unrelated things
pandas/core/frame.py
Outdated
``df.fillna(df.mode().iloc[0])`` | ||
Get the mode(s) of each element along the axis selected. | ||
|
||
Adds a row for each mode per label, filling gaps with NaN. |
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.
can add a line explaining what mode is
pandas/core/frame.py
Outdated
* 1 or 'columns' : get mode of each row | ||
The axis to iterate over while searching for the mode. | ||
To find the mode for each column, iterate over rows (``axis=0``, | ||
default behaviour). |
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 don't need the parens, it doesn't read well
pandas/core/frame.py
Outdated
Notes | ||
----- | ||
There may be multiple values returned for the selected | ||
axis (when more than one item share the maximum frequency), which is |
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.
no parens, just use a comma. capitalize DataFrame.
you can leave off the impute sentence
pandas/core/frame.py
Outdated
See Also | ||
-------- | ||
Series.mode : Return the highest frequency value in a Series. | ||
Series.value_counts : Returns a Series with all occuring values as |
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.
counts of values
pandas/core/frame.py
Outdated
1 2 | ||
""" | ||
|
||
``mode`` returns a DataFrame with multiple rows if there is more than |
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 don't need this sentence as its above
pandas/core/frame.py
Outdated
>>> grades.apply(lambda x: x.value_counts()) | ||
Science Math | ||
70 2 2 | ||
75 2 2 |
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.
put the mode example first
Codecov Report
@@ Coverage Diff @@
## master #20241 +/- ##
=========================================
Coverage ? 91.72%
=========================================
Files ? 150
Lines ? 49162
Branches ? 0
=========================================
Hits ? 45096
Misses ? 4066
Partials ? 0
Continue to review full report at Codecov.
|
I've made the requested changes to the text. The validation and PEP8 scripts passed. I'm not sure how to address the CI failures on my end. Is there anything else I need to do? |
Superseded by #22404 (discontinued PR, and the source branch does not exist anymore). |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
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.