polars.Series.any#

Series.any(*, ignore_nulls: Literal[True] = True) bool[source]#
Series.any(*, ignore_nulls: bool) bool | None

Return whether any of the values in the column are True.

Only works on columns of data type Boolean.

Parameters:
ignore_nulls

Ignore null values (default).

If set to False, Kleene logic is used to deal with nulls: if the column contains any null values and no True values, the output is None.

Returns:
bool or None

Examples

>>> pl.Series([True, False]).any()
True
>>> pl.Series([False, False]).any()
False
>>> pl.Series([None, False]).any()
False

Enable Kleene logic by setting ignore_nulls=False.

>>> pl.Series([None, False]).any(ignore_nulls=False)  # Returns None