Skip to content

DOC Fix EX01 issues in docstrings #51593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
72 changes: 70 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down