polars.Series.n_unique#

Series.n_unique() int[source]#

Count the number of unique values in this Series.

null is considered to be a unique value for the purposes of this operation.

Examples

>>> s = pl.Series("a", [1, 2, 2, None])
>>> s.n_unique()
3