polars.Expr.bitwise_or#
- Expr.bitwise_or() Expr [source]#
Perform an aggregation of bitwise ORs.
Examples
>>> df = pl.DataFrame({"n": [-1, 0, 1]}) >>> df.select(pl.col("n").bitwise_or()) shape: (1, 1) ┌─────┐ │ n │ │ --- │ │ i64 │ ╞═════╡ │ -1 │ └─────┘ >>> df = pl.DataFrame( ... {"grouper": ["a", "a", "a", "b", "b"], "n": [-1, 0, 1, -1, 1]} ... ) >>> df.group_by("grouper", maintain_order=True).agg(pl.col("n").bitwise_or()) shape: (2, 2) ┌─────────┬─────┐ │ grouper ┆ n │ │ --- ┆ --- │ │ str ┆ i64 │ ╞═════════╪═════╡ │ a ┆ -1 │ │ b ┆ -1 │ └─────────┴─────┘