diff --git a/ci/code_checks.sh b/ci/code_checks.sh index c28b2b8dd8f64..0065b04dc09c1 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -201,7 +201,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.list.flatten SA01" \ -i "pandas.Series.list.len SA01" \ -i "pandas.Series.lt PR07,SA01" \ - -i "pandas.Series.mean RT03,SA01" \ -i "pandas.Series.min RT03" \ -i "pandas.Series.mod PR07" \ -i "pandas.Series.mode SA01" \ diff --git a/pandas/core/series.py b/pandas/core/series.py index 36b9bd2c59dce..06fad8bfdac99 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -6266,7 +6266,6 @@ def prod( ) @deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="mean") - @doc(make_doc("mean", ndim=1)) def mean( self, axis: Axis | None = 0, @@ -6274,6 +6273,48 @@ def mean( numeric_only: bool = False, **kwargs, ) -> Any: + """ + Return the mean of the values over the requested axis. + + Parameters + ---------- + axis : {index (0)} + Axis for the function to be applied on. + For `Series` this parameter is unused and defaults to 0. + + For DataFrames, specifying ``axis=None`` will apply the aggregation + across both axes. + + .. versionadded:: 2.0.0 + + skipna : bool, default True + Exclude NA/null values when computing the result. + numeric_only : bool, default False + Include only float, int, boolean columns. + **kwargs + Additional keyword arguments to be passed to the function. + + Returns + ------- + scalar or Series (if level specified) + Median of the values for the requested axis. + + See Also + -------- + numpy.median : Equivalent numpy function for computing median. + Series.sum : Sum of the values. + Series.median : Median of the values. + Series.std : Standard deviation of the values. + Series.var : Variance of the values. + Series.min : Minimum value. + Series.max : Maximum value. + + Examples + -------- + >>> s = pd.Series([1, 2, 3]) + >>> s.mean() + 2.0 + """ return NDFrame.mean( self, axis=axis, skipna=skipna, numeric_only=numeric_only, **kwargs )