dtoolkit.accessor.series.groupby_index#

dtoolkit.accessor.series.groupby_index(s: Series, /, **kwargs) SeriesGroupBy[source]#

Group Series by its index.

Parameters:
**kwargs

See the documentation for groupby() for complete details on the keyword arguments except by.

Returns:
SeriesGroupBy

Notes

by parameter is set to s.index and can’t be overridden.

Examples

>>> import dtoolkit
>>> import pandas as pd
>>> s = pd.Series([1, 1, 1], index=['a', 'b', 'a'])
>>> s
a    1
b    1
a    1
dtype: int64
>>> s.groupby_index().count()
a    2
b    1
dtype: int64