polars.Series.arr.unique#
- Series.arr.unique(*, maintain_order: bool = False) Series [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_overrides={"a": pl.Array(inner=pl.Int64, width=3)}, ... ) >>> df.select(pl.col("a").arr.unique()) shape: (1, 1) ┌───────────┐ │ a │ │ --- │ │ list[i64] │ ╞═══════════╡ │ [1, 2] │ └───────────┘