pandas.api.extensions.ExtensionArray._reduce#
- ExtensionArray._reduce(name, *, skipna=True, keepdims=False, **kwargs)[source]#
Return a scalar result of performing the reduction operation.
- Parameters:
- namestr
Name of the function, supported values are: { any, all, min, max, sum, mean, median, prod, std, var, sem, kurt, skew }.
- skipnabool, default True
If True, skip NaN values.
- keepdimsbool, default False
If False, a scalar is returned. If True, the result has dimension with size one along the reduced axis.
- **kwargs
Additional keyword arguments passed to the reduction function. Currently, ddof is the only supported kwarg.
- Returns:
- scalar or ndarray:
The result of the reduction operation. The type of the result depends on keepdims: - If keepdims is False, a scalar value is returned. - If keepdims is True, the result is wrapped in a numpy array with a single element.
- Raises:
- TypeErrorsubclass does not define operations
See also
Series.minReturn the minimum value.
Series.maxReturn the maximum value.
Series.sumReturn the sum of values.
Series.meanReturn the mean of values.
Series.medianReturn the median of values.
Series.stdReturn the standard deviation.
Series.varReturn the variance.
Series.prodReturn the product of values.
Series.semReturn the standard error of the mean.
Series.kurtReturn the kurtosis.
Series.skewReturn the skewness.
Examples
>>> pd.array([1, 2, 3])._reduce("min") np.int64(1) >>> pd.array([1, 2, 3])._reduce("max") np.int64(3) >>> pd.array([1, 2, 3])._reduce("sum") np.int64(6) >>> pd.array([1, 2, 3])._reduce("mean") np.float64(2.0) >>> pd.array([1, 2, 3])._reduce("median") np.float64(2.0)