-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Correct/update skipna docstrings for any
and all
(#23109)
#24069
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 7 commits
df91bcb
95dd70a
fa0eda9
fa9ca72
736717c
1b46cf7
bdfcf96
e0aa826
7a8b8c1
69ca617
c3a1eec
3282143
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 |
---|---|---|
|
@@ -9894,11 +9894,11 @@ def _add_numeric_operations(cls): | |
axis_descr, name, name2 = _doc_parms(cls) | ||
|
||
cls.any = _make_logical_function( | ||
cls, 'any', name, name2, axis_descr, | ||
_any_desc, nanops.nanany, _any_examples, _any_see_also) | ||
cls, 'any', name, name2, axis_descr, _any_doc, nanops.nanany, | ||
_any_examples, _any_see_also, empty_value=False) | ||
cls.all = _make_logical_function( | ||
cls, 'all', name, name2, axis_descr, _all_doc, | ||
nanops.nanall, _all_examples, _all_see_also) | ||
cls, 'all', name, name2, axis_descr, _all_doc, nanops.nanall, | ||
_all_examples, _all_see_also, empty_value=True) | ||
|
||
@Substitution(outname='mad', | ||
desc="Return the mean absolute deviation of the values " | ||
|
@@ -10223,8 +10223,10 @@ def _doc_parms(cls): | |
Include only boolean columns. If None, will attempt to use everything, | ||
then use only boolean data. Not implemented for Series. | ||
skipna : boolean, default True | ||
Exclude NA/null values. If an entire row/column is NA, the result | ||
will be NA. | ||
Exclude NA/null values. If the entire row/column is NA and skipna is | ||
True, then the result will be %(empty_value)s, as for an empty row/column. | ||
If skipna is False, then NA are treated as True, because these are not | ||
equal to zero. | ||
level : int or level name, default None | ||
If the axis is a MultiIndex (hierarchical), count along a | ||
particular level, collapsing into a %(name1)s. | ||
|
@@ -10234,28 +10236,37 @@ def _doc_parms(cls): | |
|
||
Returns | ||
------- | ||
%(outname)s : %(name1)s or %(name2)s (if level specified) | ||
%(outname)s : %(name1)s or %(name2)s | ||
If level is specified, then, %(name2)s is returned; otherwise, %(name1)s | ||
is returned. | ||
|
||
%(see_also)s | ||
%(examples)s""" | ||
|
||
_all_doc = """\ | ||
Return whether all elements are True, potentially over an axis. | ||
|
||
Returns True if all elements within a series or along a Dataframe | ||
axis are non-zero, not-empty or not-False.""" | ||
Returns True unless there at least one element within a series or | ||
along a Dataframe axis that is False or equivalent (e.g. zero or | ||
empty).""" | ||
|
||
_all_examples = """\ | ||
Examples | ||
-------- | ||
Series | ||
**Series** | ||
jamesmyatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
>>> pd.Series([True, True]).all() | ||
True | ||
>>> pd.Series([True, False]).all() | ||
False | ||
>>> pd.Series([]).all() | ||
True | ||
>>> pd.Series([np.nan]).all() | ||
True | ||
datapythonista marked this conversation as resolved.
Show resolved
Hide resolved
|
||
>>> pd.Series([np.nan]).all(skipna=False) | ||
True | ||
|
||
DataFrames | ||
**DataFrames** | ||
|
||
Create a dataframe from a dictionary. | ||
|
||
|
@@ -10596,11 +10607,12 @@ def _doc_parms(cls): | |
DataFrame.all : Return whether all elements are True over requested axis. | ||
""" | ||
|
||
_any_desc = """\ | ||
Return whether any element is True over requested axis. | ||
_any_doc = """\ | ||
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. I guess you changed the name to be consitent with the 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. Yes. I did wonder if that was the right way round. I'll change them both to I also considered moving the |
||
Return whether any element is True, potentially over an axis. | ||
|
||
Unlike :meth:`DataFrame.all`, this performs an *or* operation. If any of the | ||
values along the specified axis is True, this will return True.""" | ||
Returns False unless there at least one element within a series or | ||
along a Dataframe axis that is True or equivalent (e.g. non-zero or | ||
non-empty).""" | ||
|
||
_any_examples = """\ | ||
Examples | ||
|
@@ -10610,8 +10622,16 @@ def _doc_parms(cls): | |
For Series input, the output is a scalar indicating whether any element | ||
is True. | ||
|
||
>>> pd.Series([False, False]).any() | ||
False | ||
>>> pd.Series([True, False]).any() | ||
True | ||
>>> pd.Series([]).any() | ||
False | ||
>>> pd.Series([np.nan]).any() | ||
False | ||
>>> pd.Series([np.nan]).any(skipna=False) | ||
True | ||
|
||
jamesmyatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
**DataFrame** | ||
|
||
|
@@ -10896,10 +10916,11 @@ def cum_func(self, axis=None, skipna=True, *args, **kwargs): | |
return set_function_name(cum_func, name, cls) | ||
|
||
|
||
def _make_logical_function(cls, name, name1, name2, axis_descr, desc, f, | ||
examples, see_also): | ||
def _make_logical_function(cls, name, name1, name2, axis_descr, | ||
desc, f, examples, see_also, empty_value): | ||
@Substitution(outname=name, desc=desc, name1=name1, name2=name2, | ||
axis_descr=axis_descr, examples=examples, see_also=see_also) | ||
empty_value=empty_value, axis_descr=axis_descr, | ||
examples=examples, see_also=see_also) | ||
@Appender(_bool_doc) | ||
def logical_func(self, axis=0, bool_only=None, skipna=True, level=None, | ||
**kwargs): | ||
|
Uh oh!
There was an error while loading. Please reload this page.