#NEWLINE# def get_slices( self , level = 0 ) : #NEWLINE# #INDENT# '\n        Sets the slices attribute to be a list of indices of the sorted\n        groups for the first index level. I.e., self.slices[0] is the\n        index where each observation is in the first (sorted) group.\n        ' #NEWLINE# groups = self . index . get_level_values ( level ) . unique ( ) #NEWLINE# groups . sort ( ) #NEWLINE# if isinstance ( self . index , MultiIndex ) : #NEWLINE# #INDENT# self . slices = [ self . index . get_loc_level ( x , level = level ) [ 0 ] for x in groups ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . slices = [ self . index . get_loc ( x ) for x in groups ]