diff --git a/ci/code_checks.sh b/ci/code_checks.sh index bb1b2ab8accbb..8fefa47c16bab 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -93,8 +93,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Series.item \ pandas.Series.pipe \ pandas.Series.mode \ - pandas.Series.sem \ - pandas.Series.skew \ pandas.Series.is_unique \ pandas.Series.is_monotonic_increasing \ pandas.Series.is_monotonic_decreasing \ @@ -542,8 +540,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.DataFrame.keys \ pandas.DataFrame.iterrows \ pandas.DataFrame.pipe \ - pandas.DataFrame.sem \ - pandas.DataFrame.skew \ pandas.DataFrame.backfill \ pandas.DataFrame.pad \ pandas.DataFrame.swapaxes \ diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 821e41db6b065..003e4cc5b8b23 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -11382,7 +11382,41 @@ def all( name2=name2, axis_descr=axis_descr, notes="", - examples="", + examples=""" + + Examples + -------- + >>> s = pd.Series([1, 2, 3]) + >>> s.sem().round(6) + 0.57735 + + 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.sem() + a 0.5 + b 0.5 + dtype: float64 + + Using axis=1 + + >>> df.sem(axis=1) + tiger 0.5 + zebra 0.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.sem(numeric_only=True) + a 0.5 + dtype: float64""", ) def sem( self, @@ -11615,7 +11649,45 @@ def mean( axis_descr=axis_descr, min_count="", see_also="", - examples="", + examples=""" + + Examples + -------- + >>> s = pd.Series([1, 2, 3]) + >>> s.skew() + 0.0 + + With a DataFrame + + >>> df = pd.DataFrame({'a': [1, 2, 3], 'b': [2, 3, 4], 'c': [1, 3, 5]}, + ... index=['tiger', 'zebra', 'cow']) + >>> df + a b c + tiger 1 2 1 + zebra 2 3 3 + cow 3 4 5 + >>> df.skew() + a 0.0 + b 0.0 + c 0.0 + dtype: float64 + + Using axis=1 + + >>> df.skew(axis=1) + tiger 1.732051 + zebra -1.732051 + cow 0.000000 + dtype: float64 + + In this case, `numeric_only` should be set to `True` to avoid + getting an error. + + >>> df = pd.DataFrame({'a': [1, 2, 3], 'b': ['T', 'Z', 'X']}, + ... index=['tiger', 'zebra', 'cow']) + >>> df.skew(numeric_only=True) + a 0.0 + dtype: float64""", ) def skew( self,