code: def reduce(self, values, operator=np.add, axis=0, dtype=None):
          
          values = np.take(values, self.index.sorter, axis=axis)
          return operator.reduceat(values, self.index.start, axis=axis, dtype=dtype)
docs: Reduce the values over identical key groups, using the given ufunc
          reduction is over the first axis, which should have elements corresponding to the keys
          all other axes are treated indepenently for the sake of this reduction
  
          Parameters
          ----------
          values : ndarray, [keys, ...]
              values to perform reduction over
          operator : numpy.ufunc
              a numpy ufunc, such as np.add or np.sum
          axis : int, optional
              the axis to reduce over
          dtype : output dtype
  
          Returns
          -------
          ndarray, [groups, ...]
          values reduced by operator over the key-groups