-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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:Remove hard-coded examples from _flex_doc_SERIES (#24589) #25524
DOC:Remove hard-coded examples from _flex_doc_SERIES (#24589) #25524
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25524 +/- ##
==========================================
+ Coverage 91.75% 91.76% +<.01%
==========================================
Files 173 173
Lines 52960 52964 +4
==========================================
+ Hits 48595 48600 +5
+ Misses 4365 4364 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25524 +/- ##
=========================================
- Coverage 91.75% 91.26% -0.5%
=========================================
Files 173 173
Lines 52960 52970 +10
=========================================
- Hits 48595 48341 -254
- Misses 4365 4629 +264
Continue to review full report at Codecov.
|
pandas/core/ops.py
Outdated
d 1.0 | ||
e NaN | ||
dtype: float64 | ||
>>> a.multiply(b) |
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.
Maybe provide a fill_value
here, to be consistent with the others?
Thanks for working on this. I think it's OK that other ops like mod (temporarily) lack examples. Two questions
|
Hello @danielplawrence! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-03-05 21:10:44 UTC |
Brief update:
Series.divmod examples>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd']) >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e']) >>> divmod(a,b) (a 1.0 b NaN c NaN d NaN e NaN dtype: float64, a 0.0 b NaN c NaN d NaN e NaN dtype: float64) >>> a.divmod(b) Traceback (most recent call last): File "", line 1, in File "/Users/danlaw/Projects/pandas/pandas/core/ops.py", line 2046, in flex_wrapper return self._binop(other, op, level=level, fill_value=fill_value) File "/Users/danlaw/Projects/pandas/pandas/core/series.py", line 2522, in _binop result = self._constructor(result, index=new_index, name=name) File "/Users/danlaw/Projects/pandas/pandas/core/series.py", line 250, in __init__ .format(val=len(data), ind=len(index))) ValueError: Length of passed values is 2, index implies 5
Full output of validate_docstrings.py(pandas-dev) 8c8590165d94% for op in add sub mul mod pow truediv floordiv do python3 scripts/validate_docstrings.py pandas.Series.$op done Example ValueError from axis parameter>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd']) >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e']) >>> a.add(b) a 2.0 b NaN c NaN d NaN e NaN dtype: float64 >>> a.add(b,axis=0) a 2.0 b NaN c NaN d NaN e NaN dtype: float64 >>> a.add(b,axis=1) Traceback (most recent call last): File "", line 1, in File "/Users/danlaw/Projects/pandas/pandas/core/ops.py", line 2044, in flex_wrapper self._get_axis_number(axis) File "/Users/danlaw/Projects/pandas/pandas/core/generic.py", line 361, in _get_axis_number .format(axis, type(cls))) ValueError: No axis named 1 for object type |
pandas/core/ops.py
Outdated
doc = base_doc.format(desc=op_desc['desc'], op_name=op_name, | ||
equiv=equiv, reverse=op_desc['reverse']) | ||
doc_no_examples = base_doc.format(desc=op_desc['desc'], | ||
op_name=op_name, equiv=equiv, reverse=op_desc['reverse']) |
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.
I think this is what failed the build. Should be aligned with the open paren on the previous line, or move desc=...
down here.
Thanks @danielplawrence. The divmod failure is being worked on elsewhere, and documenting |
* upstream/master: (110 commits) DOC: hardcode contributors for 0.24.x releases (pandas-dev#25662) DOC: restore toctree maxdepth (pandas-dev#25134) BUG: Redefine IndexOpsMixin.size, fix pandas-dev#25580. (pandas-dev#25584) BUG: to_csv line endings with compression (pandas-dev#25625) DOC: file obj for to_csv must be newline='' (pandas-dev#25624) Suppress incorrect warning in nargsort for timezone-aware DatetimeIndex (pandas-dev#25629) TST: fix incorrect sparse test (now failing on scipy master) (pandas-dev#25653) CLN: Removed debugging code (pandas-dev#25647) DOC: require Return section only if return is not None nor commentary (pandas-dev#25008) DOC:Remove hard-coded examples from _flex_doc_SERIES (pandas-dev#24589) (pandas-dev#25524) TST: xref pandas-dev#25630 (pandas-dev#25643) BUG: Fix pandas-dev#25481 by fixing the error message in TypeError (pandas-dev#25540) Fixturize tests/frame/test_mutate_columns.py (pandas-dev#25642) Fixturize tests/frame/test_join.py (pandas-dev#25639) Fixturize tests/frame/test_combine_concat.py (pandas-dev#25634) Fixturize tests/frame/test_asof.py (pandas-dev#25628) BUG: Fix user-facing AssertionError with to_html (pandas-dev#25608) (pandas-dev#25620) DOC: resolve all GL03 docstring validation errors (pandas-dev#25525) TST: failing wheel building on PY2 and old numpy (pandas-dev#25631) DOC: Remove makePanel from docs (pandas-dev#25609) (pandas-dev#25612) ...
Initial work on #24589
Ops outside not in [add, sub, mul, div] will return their docstring with no examples in this revision.