@@ -2004,16 +2004,47 @@ def _reduce(
2004
2004
2005
2005
Returns
2006
2006
-------
2007
- scalar
2007
+ scalar or ndarray:
2008
+ The result of the reduction operation. The type of the result
2009
+ depends on `keepdims`:
2010
+ - If `keepdims` is `False`, a scalar value is returned.
2011
+ - If `keepdims` is `True`, the result is wrapped in a numpy array with
2012
+ a single element.
2008
2013
2009
2014
Raises
2010
2015
------
2011
2016
TypeError : subclass does not define operations
2012
2017
2018
+ See Also
2019
+ --------
2020
+ Series.min : Return the minimum value.
2021
+ Series.max : Return the maximum value.
2022
+ Series.sum : Return the sum of values.
2023
+ Series.mean : Return the mean of values.
2024
+ Series.median : Return the median of values.
2025
+ Series.std : Return the standard deviation.
2026
+ Series.var : Return the variance.
2027
+ Series.prod : Return the product of values.
2028
+ Series.sem : Return the standard error of the mean.
2029
+ Series.kurt : Return the kurtosis.
2030
+ Series.skew : Return the skewness.
2031
+
2013
2032
Examples
2014
2033
--------
2015
2034
>>> pd.array([1, 2, 3])._reduce("min")
2016
2035
1
2036
+ >>> pd.array([1, 2, 3])._reduce("max")
2037
+ 3
2038
+ >>> pd.array([1, 2, 3])._reduce("sum")
2039
+ 6
2040
+ >>> pd.array([1, 2, 3])._reduce("mean")
2041
+ 2.0
2042
+ >>> pd.array([1, 2, 3])._reduce("median")
2043
+ 2.0
2044
+ >>> pd.array([1, np.nan, 2, np.nan])._reduce("sum", skipna=False)
2045
+ nan
2046
+ >>> pd.array([1, np.nan, 2, np.nan])._reduce("sum", skipna=True)
2047
+ 3
2017
2048
"""
2018
2049
meth = getattr (self , name , None )
2019
2050
if meth is None :
0 commit comments