docstr: Sets the slices attribute to be a list of indices of the sorted
  groups for the first index level. I.e., self.slices[0] is the
  index where each observation is in the first (sorted) group.
docstr_tok: ["Sets","the","slices","attribute","to","be","a","list","of","indices","of","the","sorted","groups","for","the","first","index","level",".","I.e.",",","self.slices","[","0","]","is","the","index","where","each","observation","is","in","the","first","(","sorted",")","group","."]
code: def get_slices(self, level=0):
      """
      Sets the slices attribute to be a list of indices of the sorted
      groups for the first index level. I.e., self.slices[0] is the
      index where each observation is in the first (sorted) group.
      """
      # TODO: refactor this
      groups = self.index.get_level_values(level).unique()
      groups = np.array(groups)
      groups.sort()
      if isinstance(self.index, MultiIndex):
          self.slices = [
              self.index.get_loc_level(x, level=level)[0]
              for x in groups
          ]
      else:
          self.slices = [self.index.get_loc(x) for x in groups]
  
imports: from statsmodels.compat.python import lrange, lzip
  import numpy
  import pandas
  import statsmodels.tools.data
  from pandas import Index, MultiIndex
label_desc: Use image node_id 7 for calling the Grouping obj's underlying member method code with example usage: obj.get_slices(level) without return types