Skip to content

Evaluate the number of unset bits.

Description

Evaluate the number of unset bits.

Usage

<Expr>$bitwise_count_zeros()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(n = c(-1L, 0L, 2L, 1L))
df$with_columns(unset_bits = pl$col("n")$bitwise_count_zeros())
#> shape: (4, 2)
#> ┌─────┬────────────┐
#> │ n   ┆ unset_bits │
#> │ --- ┆ ---        │
#> │ i32 ┆ u32        │
#> ╞═════╪════════════╡
#> │ -1  ┆ 0          │
#> │ 0   ┆ 32         │
#> │ 2   ┆ 31         │
#> │ 1   ┆ 31         │
#> └─────┴────────────┘