code: def group_indices(self):
          
          # No groups
          if not self.plydata_groups:
              return np.ones(len(self), dtype=int)
  
          grouper = self.groupby()
          indices = np.empty(len(self), dtype=int)
          for i, (_, idx) in enumerate(sorted(grouper.indices.items())):
              indices[idx] = i
          return indices
docs: Return group indices