polars.any#

polars.any(name: str | Sequence[str] | Sequence[Expr] | Expr) Expr[source]#

Evaluate columnwise or elementwise with a bitwise OR operation.

Examples

>>> df = pl.DataFrame(
...     {
...         "a": [True, False, True],
...         "b": [False, False, False],
...         "c": [False, True, False],
...     }
... )
>>> df
shape: (3, 3)
┌───────┬───────┬───────┐
│ a     ┆ b     ┆ c     │
│ ---   ┆ ---   ┆ ---   │
│ bool  ┆ bool  ┆ bool  │
╞═══════╪═══════╪═══════╡
│ true  ┆ false ┆ false │
│ false ┆ false ┆ true  │
│ true  ┆ false ┆ false │
└───────┴───────┴───────┘

Compares the values (in binary format) and return true if any value in the column is true.

>>> df.select(pl.any("*"))
shape: (1, 3)
┌──────┬───────┬──────┐
│ a    ┆ b     ┆ c    │
│ ---  ┆ ---   ┆ ---  │
│ bool ┆ bool  ┆ bool │
╞══════╪═══════╪══════╡
│ true ┆ false ┆ true │
└──────┴───────┴──────┘