pandas.Index.nunique — pandas 3.0.0rc0+33.g1fd184de2a documentation (original) (raw)
Index.nunique(dropna=True)[source]#
Return number of unique elements in the object.
Excludes NA values by default.
Parameters:
dropnabool, default True
Don’t include NaN in the count.
Returns:
int
An integer indicating the number of unique elements in the object.
Examples
s = pd.Series([1, 3, 5, 7, 7]) s 0 1 1 3 2 5 3 7 4 7 dtype: int64