polars.Expr.any
-
Return whether any of the values in the column are
True.Only works on columns of data type
Boolean.- Parameters:
-
- ignore_nulls
-
- If set to
True(default), null values are ignored. If there are no non-null values, the output isFalse. - If set to
False, Kleene logic is used to deal with nulls: if the column contains any null values and noTruevalues, the output is null.
- If set to
- Returns:
-
- Expr
-
Expression of data type
Boolean.
Examples
>>> df = pl.DataFrame( ... { ... "a": [True, False], ... "b": [False, False], ... "c": [None, False], ... } ... ) >>> df.select(pl.col("*").any()) shape: (1, 3) ┌──────┬───────┬───────┐ │ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ bool ┆ bool ┆ bool │ ╞══════╪═══════╪═══════╡ │ true ┆ false ┆ false │ └──────┴───────┴───────┘Enable Kleene logic by setting
ignore_nulls=False.>>> df.select(pl.col("*").any(ignore_nulls=False)) shape: (1, 3) ┌──────┬───────┬──────┐ │ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ bool ┆ bool ┆ bool │ ╞══════╪═══════╪══════╡ │ true ┆ false ┆ null │ └──────┴───────┴──────┘
Expr.any(
*,
ignore_nulls: bool = True,
) → Expr
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.any.html