diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 759e07018a190..c2ec22020bca2 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -92,8 +92,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Series.keys \ pandas.Series.item \ pandas.Series.pipe \ - pandas.Series.mean \ - pandas.Series.median \ pandas.Series.mode \ pandas.Series.sem \ pandas.Series.skew \ @@ -543,8 +541,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.DataFrame.keys \ pandas.DataFrame.iterrows \ pandas.DataFrame.pipe \ - pandas.DataFrame.mean \ - pandas.DataFrame.median \ pandas.DataFrame.sem \ pandas.DataFrame.skew \ pandas.DataFrame.backfill \ diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 6c47418545307..9bdfb8da0c7cb 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -11516,7 +11516,41 @@ def prod( axis_descr=axis_descr, min_count="", see_also="", - examples="", + examples=""" + + Examples + -------- + >>> s = pd.Series([1, 2, 3]) + >>> s.mean() + 2.0 + + With a DataFrame + + >>> df = pd.DataFrame({'a': [1, 2], 'b': [2, 3]}, index=['tiger', 'zebra']) + >>> df + a b + tiger 1 2 + zebra 2 3 + >>> df.mean() + a 1.5 + b 2.5 + dtype: float64 + + Using axis=1 + + >>> df.mean(axis=1) + tiger 1.5 + zebra 2.5 + dtype: float64 + + In this case, `numeric_only` should be set to `True` to avoid + getting an error. + + >>> df = pd.DataFrame({'a': [1, 2], 'b': ['T', 'Z']}, + ... index=['tiger', 'zebra']) + >>> df.mean(numeric_only=True) + a 1.5 + dtype: float64""", ) def mean( self, @@ -11624,7 +11658,41 @@ def kurt( axis_descr=axis_descr, min_count="", see_also="", - examples="", + examples=""" + + Examples + -------- + >>> s = pd.Series([1, 2, 3]) + >>> s.median() + 2.0 + + With a DataFrame + + >>> df = pd.DataFrame({'a': [1, 2], 'b': [2, 3]}, index=['tiger', 'zebra']) + >>> df + a b + tiger 1 2 + zebra 2 3 + >>> df.median() + a 1.5 + b 2.5 + dtype: float64 + + Using axis=1 + + >>> df.median(axis=1) + tiger 1.5 + zebra 2.5 + dtype: float64 + + In this case, `numeric_only` should be set to `True` + to avoid getting an error. + + >>> df = pd.DataFrame({'a': [1, 2], 'b': ['T', 'Z']}, + ... index=['tiger', 'zebra']) + >>> df.median(numeric_only=True) + a 1.5 + dtype: float64""", ) def median( self,