Skip to content

Get the index of the first unique value

Description

Get the index of the first unique value

Usage

<Expr>$arg_unique()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = 1:3, b = c(NA, 4, 4))
df$select(pl$col("a")$arg_unique())
#> shape: (3, 1)
#> ┌─────┐
#> │ a   │
#> │ --- │
#> │ u32 │
#> ╞═════╡
#> │ 0   │
#> │ 1   │
#> │ 2   │
#> └─────┘
df$select(pl$col("b")$arg_unique())
#> shape: (2, 1)
#> ┌─────┐
#> │ b   │
#> │ --- │
#> │ u32 │
#> ╞═════╡
#> │ 0   │
#> │ 1   │
#> └─────┘