pandas.api.extensions.ExtensionArray._reduce#
- ExtensionArray._reduce(name, *, skipna=True, keepdims=False, **kwargs)[源代码][源代码]#
返回执行归约操作的标量结果。
- 参数:
- 名字str
函数的名称,支持的值有:{ any, all, min, max, sum, mean, median, prod, std, var, sem, kurt, skew }。
- skipna布尔值, 默认为 True
如果为真,跳过 NaN 值。
- keepdimsbool, 默认为 False
如果为 False,则返回一个标量。如果为 True,结果的维度在减少的轴上大小为 1。
- **kwargs
传递给归约函数的额外关键字参数。目前,ddof 是唯一支持的关键字参数。
- 返回:
- 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.
- 引发:
- TypeError子类未定义操作
参见
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.
例子
>>> pd.array([1, 2, 3])._reduce("min") 1 >>> pd.array([1, 2, 3])._reduce("max") 3 >>> pd.array([1, 2, 3])._reduce("sum") 6 >>> pd.array([1, 2, 3])._reduce("mean") 2.0 >>> pd.array([1, 2, 3])._reduce("median") 2.0