polars.Expr.arr.unique#
- Expr.arr.unique(*, maintain_order: bool = False) Expr [source]#
Get the unique/distinct values in the array.
- Parameters:
- maintain_order
Maintain order of data. This requires more work.
Examples
>>> df = pl.DataFrame( ... { ... "a": [[1, 1, 2]], ... }, ... schema={"a": pl.Array(pl.Int64, 3)}, ... ) >>> df.select(pl.col("a").arr.unique()) shape: (1, 1) ┌───────────┐ │ a │ │ --- │ │ list[i64] │ ╞═══════════╡ │ [1, 2] │ └───────────┘