code: def cardinal_groupby(self):
          
          g, t = self._cardinal
          self[g] = self[g].astype(t)
          grpby = self.groupby(g)
          self[g] = self[g].astype('category')
          return grpby
docs: Group this object on it cardinal dimension (_cardinal).
  
          Returns:
              grpby: Pandas groupby object (grouped on _cardinal)