def _min_or_max(self, axis, min_or_max):
        if axis is None:
            if 0 in self.shape:
                raise ValueError("zero-size array to reduction operation")

            zero = self.dtype.type(0)
            if self.nnz == 0:
                return zero
            m = min_or_max.reduce(self._deduped_data().ravel())
            if self.nnz != np.product(self.shape):
                m = min_or_max(zero, m)
            return m

        if axis < 0:
            axis += 2
        if (axis == 0) or (axis == 1):
            return self._min_or_max_axis(axis, min_or_max)
        else:
            raise ValueError("invalid axis, use 0 for rows, or 1 for columns")
dataset/ETHPy150Open scipy/scipy/scipy/sparse/data.py/_minmax_mixin._min_or_max/original