Skip to content

Check whether each value is unique

Source code

Description

Check whether each value is unique

Usage

<Expr>$is_unique()

Value

Expr

Examples

library("polars")

as_polars_df(head(mtcars[, 1:2]))$
  with_columns(is_unique = pl$col("mpg")$is_unique())
#> shape: (6, 3)
#> ┌──────┬─────┬───────────┐
#> │ mpg  ┆ cyl ┆ is_unique │
#> │ ---  ┆ --- ┆ ---       │
#> │ f64  ┆ f64 ┆ bool      │
#> ╞══════╪═════╪═══════════╡
#> │ 21.0 ┆ 6.0 ┆ false     │
#> │ 21.0 ┆ 6.0 ┆ false     │
#> │ 22.8 ┆ 4.0 ┆ true      │
#> │ 21.4 ┆ 6.0 ┆ true      │
#> │ 18.7 ┆ 8.0 ┆ true      │
#> │ 18.1 ┆ 6.0 ┆ true      │
#> └──────┴─────┴───────────┘