pandas.Index.groupby

Index.groupby(to_groupby)[source]

Group the index labels by a given array of values.

Parameters:

to_groupby : array

Values used to determine the groups.

Returns:

groups : dict

{group name -> group labels}