pandas.core.window.expanding.Expanding.nunique#
- Expanding.nunique(numeric_only=False)[source]#
Calculate the expanding nunique.
Added in version 3.0.0.
- Parameters:
- numeric_onlybool, default False
Include only float, int, boolean columns.
Added in version 1.5.0.
- Returns:
- Series or DataFrame
Return type is the same as the original object with
np.float64dtype.
See also
Series.expandingCalling expanding with Series data.
DataFrame.expandingCalling expanding with DataFrames.
Series.nuniqueAggregating nunique for Series.
DataFrame.nuniqueAggregating nunique for DataFrame.
Examples
>>> s = pd.Series([1, 4, 2, 3, 5, 3]) >>> s.expanding().nunique() 0 1.0 1 2.0 2 3.0 3 4.0 4 5.0 5 5.0 dtype: float64