Get the lengths of runs of identical values
Description
Get the lengths of runs of identical values
Usage
<Expr>$rle()
Value
Expr
Examples
library("polars")
df = pl$DataFrame(s = c(1, 1, 2, 1, NA, 1, 3, 3))
df$select(pl$col("s")$rle())$unnest("s")
#> shape: (6, 2)
#> ┌─────┬───────┐
#> │ len ┆ value │
#> │ --- ┆ --- │
#> │ u32 ┆ f64 │
#> ╞═════╪═══════╡
#> │ 2 ┆ 1.0 │
#> │ 1 ┆ 2.0 │
#> │ 1 ┆ 1.0 │
#> │ 1 ┆ null │
#> │ 1 ┆ 1.0 │
#> │ 2 ┆ 3.0 │
#> └─────┴───────┘