-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improved the docstring of Series.any() #20078
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
Changes from 3 commits
634543f
bb3ba08
8303f97
8737e31
680f48c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7522,7 +7522,7 @@ def _add_numeric_operations(cls): | |
|
||
cls.any = _make_logical_function( | ||
cls, 'any', name, name2, axis_descr, | ||
'Return whether any element is True over requested axis', | ||
'Return whether any element is True over requested axis.', | ||
nanops.nanany) | ||
cls.all = _make_logical_function( | ||
cls, 'all', name, name2, axis_descr, | ||
|
@@ -7784,25 +7784,49 @@ def _doc_parms(cls): | |
%(outname)s : %(name1)s or %(name2)s (if level specified)\n""" | ||
|
||
_bool_doc = """ | ||
|
||
%(desc)s | ||
Returns True if one (or more) elements are non-zero, | ||
not-empty or not-False. | ||
|
||
Also note that a series consisting of different | ||
data types returns the first occurence of the | ||
non-zero, not-empty or not-False element. | ||
|
||
Parameters | ||
---------- | ||
axis : %(axis_descr)s | ||
skipna : boolean, default True | ||
Exclude NA/null values. If an entire row/column is NA, the result | ||
will be NA | ||
will be NA. | ||
level : int or level name, default None | ||
If the axis is a MultiIndex (hierarchical), count along a | ||
particular level, collapsing into a %(name1)s | ||
particular level, collapsing into a %(name1)s. | ||
bool_only : boolean, default None | ||
Include only boolean columns. If None, will attempt to use everything, | ||
then use only boolean data. Not implemented for Series. | ||
**kwargs : | ||
Additional keywords have no effect but might be accepted for | ||
compatibility with numpy. | ||
|
||
Returns | ||
------- | ||
%(outname)s : %(name1)s or %(name2)s (if level specified)\n""" | ||
%(outname)s : %(name1)s or %(name2)s (if level specified) | ||
|
||
Examples | ||
-------- | ||
>>> s1 = pd.Series([1,2,3]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add spaces after the commas here so this is pep8 compliant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, will do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
>>> s1.any() | ||
True | ||
|
||
>>> import numpy as np | ||
>>> s2 = pd.Series([np.NaN,np.NaN,np.NaN]) | ||
>>> s2.any() | ||
False | ||
|
||
>>> s3 = pd.Series([1,2,3,"Hobbit"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This last one is a bug: #12863 It should return True / False. I think just remove it for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I sensed it 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
>>> s3.any() | ||
1 | ||
""" | ||
|
||
_cnum_doc = """ | ||
|
||
|
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.
Missing description
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.
(never mind)