pandas.core.resample.Resampler.nunique#

final Resampler.nunique()[source]#

Return number of unique elements in the group.

Returns:
Series

Number of unique values within each group.

See also

core.groupby.SeriesGroupBy.nunique

Method nunique for SeriesGroupBy.

Examples

>>> ser = pd.Series(
...     [1, 2, 3, 3],
...     index=pd.DatetimeIndex(
...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
...     ),
... )
>>> ser
2023-01-01    1
2023-01-15    2
2023-02-01    3
2023-02-15    3
dtype: int64
>>> ser.resample("MS").nunique()
2023-01-01    2
2023-02-01    1
Freq: MS, dtype: int64