polars.all

polars.all(name: Optional[Union[str, List[polars.internals.expr.Expr]]] = None) polars.internals.expr.Expr

This function is two things

  • function can do a columnwise or elementwise AND operation

  • a wildcard column selection

Parameters
name

If given this function will apply a bitwise & on the columns.

Examples

Sum all columns

>>> df = pl.DataFrame(
...     {"a": [1, 2, 3], "b": ["hello", "foo", "bar"], "c": [1, 1, 1]}
... )
>>> df.select(pl.all().sum())
shape: (1, 3)
┌─────┬──────┬─────┐
│ a   ┆ b    ┆ c   │
│ --- ┆ ---  ┆ --- │
│ i64 ┆ str  ┆ i64 │
╞═════╪══════╪═════╡
│ 6   ┆ null ┆ 3   │
└─────┴──────┴─────┘