MCPcopy
hub / github.com/pandas-dev/pandas / any

Method any

pandas/core/series.py:7500–7629  ·  view source on GitHub ↗

Return whether any element is True, potentially over an axis. Returns False unless there is at least one element within a series or along a Dataframe axis that is True or equivalent (e.g. non-zero or non-empty). Parameters ---------- axis :

(  # type: ignore[override]
        self,
        *,
        axis: Axis = 0,
        bool_only: bool = False,
        skipna: bool = True,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

7498
7499 # error: Signature of "any" incompatible with supertype "NDFrame"
7500 def any( # type: ignore[override]
7501 self,
7502 *,
7503 axis: Axis = 0,
7504 bool_only: bool = False,
7505 skipna: bool = True,
7506 **kwargs,
7507 ) -> bool:
7508 """
7509 Return whether any element is True, potentially over an axis.
7510
7511 Returns False unless there is at least one element within a series or
7512 along a Dataframe axis that is True or equivalent (e.g. non-zero or
7513 non-empty).
7514
7515 Parameters
7516 ----------
7517 axis : {0 or 'index', 1 or 'columns', None}, default 0
7518 Indicate which axis or axes should be reduced. For `Series` this parameter
7519 is unused and defaults to 0.
7520
7521 * 0 / 'index' : reduce the index, return a Series whose index is the
7522 original column labels.
7523 * 1 / 'columns' : reduce the columns, return a Series whose index is the
7524 original index.
7525 * None : reduce all axes, return a scalar.
7526
7527 bool_only : bool, default False
7528 Include only boolean columns. Not implemented for Series.
7529 skipna : bool, default True
7530 Exclude NA/null values. If the entire row/column is NA and skipna is
7531 True, then the result will be False, as for an empty row/column.
7532 If skipna is False, then NA are treated as True, because these are not
7533 equal to zero.
7534 **kwargs : any, default None
7535 Additional keywords have no effect but might be accepted for
7536 compatibility with NumPy.
7537
7538 Returns
7539 -------
7540 Series or scalar
7541 If axis=None, then a scalar boolean is returned.
7542 Otherwise a Series is returned with index matching the index argument.
7543
7544 See Also
7545 --------
7546 numpy.any : Numpy version of this method.
7547 Series.any : Return whether any element is True.
7548 Series.all : Return whether all elements are True.
7549 DataFrame.any : Return whether any element is True over requested axis.
7550 DataFrame.all : Return whether all elements are True over requested axis.
7551
7552 Examples
7553 --------
7554 **Series**
7555
7556 For Series input, the output is a scalar indicating whether any element
7557 is True.

Callers 15

test_all_anyMethod · 0.95
test_all_any_skipnaMethod · 0.95
time_anyMethod · 0.45
_plotMethod · 0.45
__init__Method · 0.45
_has_infsFunction · 0.45
_get_valuesFunction · 0.45
nananyFunction · 0.45

Calls 2

_reduceMethod · 0.95
validate_bool_kwargFunction · 0.90

Tested by 5

test_all_anyMethod · 0.76
test_all_any_skipnaMethod · 0.76