pandas.Series.nunique

pandas 3.1.1 · Series and accessors · method

Count distinct values. Set dropna=False to count missing values where supported.

Call syntax

Series.nunique(dropna=True)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
dropna Optional
Positional or keyword
Default True
bool

Choose whether to drop missing values or missing keys from consideration.

Returns

int