Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ Other Enhancements
- :meth:`DataFrame.to_stata` and :class:` pandas.io.stata.StataWriter117` can write mixed sting columns to Stata strl format (:issue:`23633`)
- :meth:`DataFrame.between_time` and :meth:`DataFrame.at_time` have gained the an ``axis`` parameter (:issue: `8839`)
- :class:`IntervalIndex` has gained the :attr:`~IntervalIndex.is_overlapping` attribute to indicate if the ``IntervalIndex`` contains any overlapping intervals (:issue:`23309`)
- :meth:`any` and :meth:`all` aggregation methods have corrected/improved docstrings for the ``skipna`` parameter (:issue:`23019`).

.. _whatsnew_0240.api_breaking:

Expand Down
28 changes: 21 additions & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9862,10 +9862,10 @@ def _add_numeric_operations(cls):
axis_descr, name, name2 = _doc_parms(cls)

cls.any = _make_logical_function(
cls, 'any', name, name2, axis_descr,
cls, 'any', name, name2, False, axis_descr,
_any_desc, nanops.nanany, _any_examples, _any_see_also)
cls.all = _make_logical_function(
cls, 'all', name, name2, axis_descr, _all_doc,
cls, 'all', name, name2, True, axis_descr, _all_doc,
nanops.nanall, _all_examples, _all_see_also)

@Substitution(outname='mad',
Expand Down Expand Up @@ -10188,8 +10188,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.
Expand Down Expand Up @@ -10219,6 +10221,10 @@ def _doc_parms(cls):
True
>>> pd.Series([True, False]).all()
False
>>> pd.Series([]).all()
True
>>> pd.Series([np.nan]).all()
True

DataFrames

Expand Down Expand Up @@ -10576,6 +10582,13 @@ def _doc_parms(cls):

>>> pd.Series([True, False]).any()
True
>>> pd.Series([]).any()
False
>>> pd.Series([np.nan]).any()
False
>>> pd.Series([np.nan]).any(skipna=False)
True


**DataFrame**

Expand Down Expand Up @@ -10860,10 +10873,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, empty_value, axis_descr,
desc, f, examples, see_also):
@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):
Expand Down