Perform an aggregation of bitwise ANDs.
Description
Perform an aggregation of bitwise ANDs.
Usage
<Expr>$bitwise_and()
Value
A polars expression
Examples
#> shape: (1, 1)
#> ┌─────┐
#> │ n │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 0 │
#> └─────┘
df <- pl$DataFrame(
grouper = c("a", "a", "a", "b", "b"),
n = c(-1L, 0L, 1L, -1L, 1L)
)
df$group_by("grouper", .maintain_order = TRUE)$agg(pl$col("n")$bitwise_and())
#> shape: (2, 2)
#> ┌─────────┬─────┐
#> │ grouper ┆ n │
#> │ --- ┆ --- │
#> │ str ┆ i32 │
#> ╞═════════╪═════╡
#> │ a ┆ 0 │
#> │ b ┆ 1 │
#> └─────────┴─────┘