-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: update the DataFrame.sub docstring #20358
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: update the DataFrame.sub docstring #20358
Conversation
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.
Thanks for the PR!
Can you ensure with scripts/validate_docstring.py
that everything is OK?
For me this gives errors for the examples.
pandas/core/ops.py
Outdated
@@ -370,16 +370,44 @@ def _get_op_name(op, special): | |||
e NaN 2.0 | |||
""" | |||
|
|||
_sub_example_FRAME = """ | |||
>>> a = pd.DataFrame([2, 1, 1, np.nan], index=['a', 'b', 'c', 'd'], | |||
columns=['one']) |
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 need to add ...
at the beginning of the line here.
The same for b
below
I accidentally closed this PR. Reopening |
Codecov Report
@@ Coverage Diff @@
## master #20358 +/- ##
==========================================
- Coverage 91.78% 91.77% -0.01%
==========================================
Files 152 152
Lines 49196 49176 -20
==========================================
- Hits 45153 45133 -20
Misses 4043 4043
Continue to review full report at Codecov.
|
When I added the "..." for the wrapped lines there were no more validation errors. |
@kurtiskerstein you seem to have included some unrelated commits. If you need any help with resolving this, let us know. |
Yeah. I am going back through the git documentation to figure it out. I will let you know if I have further trouble. |
a114473
to
82d5861
Compare
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.
Git problems indeed fixed!
Added two minor comments
pandas/core/ops.py
Outdated
@@ -354,7 +354,7 @@ def _get_op_name(op, special): | |||
d NaN | |||
>>> b = pd.DataFrame(dict(one=[1, np.nan, 1, np.nan], | |||
... two=[np.nan, 2, np.nan, 2]), | |||
... index=['a', 'b', 'd', 'e']) | |||
... index=['a', 'b', 'd', 'e']) |
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.
the index is not part of the dict, so the indentation was actually correct
pandas/core/ops.py
Outdated
_op_descriptions = { | ||
# Arithmetic Operators | ||
'add': {'op': '+', | ||
'desc': 'Addition', | ||
'reverse': 'radd', | ||
'df_examples': _add_example_FRAME}, | ||
# Subtraction Operators |
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.
this comment is not needed, as "sub" still belongs to the "Arithmetic operators" (the comment above)
@kurtiskerstein Thanks for the PR! |
Checklist for the pandas documentation sprint :
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:
Validation script returns docstring style errors.