modin.pandas.Series.nunique¶
- Series.nunique(dropna=True) int [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/.tox/docs/lib/python3.9/site-packages/modin/pandas/series.py#L2305-L2309)¶
Return number of unique elements in the series.
Excludes NA values by default. Snowpark pandas API does not distinguish between different NaN types like None, pd.NA, and np.nan, and treats them as the same.
- Parameters:
dropna (bool, default True) – Don’t include NaN in the count.
- Return type:
int
Examples
>>> import numpy as np >>> s = pd.Series([1, 3, 5, 7, 7]) >>> s 0 1 1 3 2 5 3 7 4 7 dtype: int64
>>> s.nunique() 4
>>> s = pd.Series([pd.NaT, np.nan, pd.NA, None, 1]) >>> s.nunique() 1
>>> s.nunique(dropna=False) 2