Skip to content

DOC: Fixing EX01 - Added examples #54162

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
Jul 17, 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
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Partially validate docstrings (EX01)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \
pandas.Series.backfill \
pandas.Series.pad \
pandas.Series.hist \
pandas.errors.AccessorRegistrationWarning \
pandas.errors.AttributeConflictWarning \
pandas.errors.DataError \
Expand Down Expand Up @@ -138,8 +135,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.api.extensions.ExtensionArray.ndim \
pandas.api.extensions.ExtensionArray.shape \
pandas.api.extensions.ExtensionArray.tolist \
pandas.DataFrame.pad \
pandas.DataFrame.plot \
pandas.DataFrame.to_gbq \
pandas.DataFrame.__dataframe__
RET=$(($RET + $?)) ; echo $MSG "DONE"
Expand Down
6 changes: 5 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7385,6 +7385,10 @@ def pad(
-------
{klass} or None
Object with missing values filled or None if ``inplace=True``.

Examples
--------
Please see examples for :meth:`DataFrame.ffill` or :meth:`Series.ffill`.
"""
warnings.warn(
"DataFrame.pad/Series.pad is deprecated. Use "
Expand Down Expand Up @@ -7521,7 +7525,7 @@ def backfill(

Examples
--------
Please see examples for :meth:`DataFrame.bfill`.
Please see examples for :meth:`DataFrame.bfill` or :meth:`Series.bfill`.
"""
warnings.warn(
"DataFrame.backfill/Series.backfill is deprecated. Use "
Expand Down
34 changes: 31 additions & 3 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ def hist_series(

Examples
--------
For Series:

.. plot::
:context: close-figs

>>> lst = ['a', 'a', 'a', 'b', 'b', 'b']
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
>>> hist = ser.hist()

For Groupby:

.. plot::
:context: close-figs
Expand Down Expand Up @@ -790,23 +800,41 @@ class PlotAccessor(PandasObject):

Examples
--------
For SeriesGroupBy:
For Series:

.. plot::
:context: close-figs

>>> ser = pd.Series([1, 2, 3, 3])
>>> plot = ser.plot(kind='hist', title="My plot")

For DataFrameGroupBy:
For DataFrame:

.. plot::
:context: close-figs

>>> df = pd.DataFrame({'length': [1.5, 0.5, 1.2, 0.9, 3],
... 'width': [0.7, 0.2, 0.15, 0.2, 1.1]},
... index=['pig', 'rabbit', 'duck', 'chicken', 'horse'])
>>> plot = df.plot()
>>> plot = df.plot(title="DataFrame Plot")

For SeriesGroupBy:

.. plot::
:context: close-figs

>>> lst = [-1, -2, -3, 1, 2, 3]
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
>>> plot = ser.groupby(lambda x: x > 0).plot(title="SeriesGroupBy Plot")

For DataFrameGroupBy:

.. plot::
:context: close-figs

>>> df = pd.DataFrame({"col1" : [1, 2, 3, 4],
... "col2" : ["A", "B", "A", "B"]})
>>> plot = df.groupby("col2").plot(kind="bar", title="DataFrameGroupBy Plot")
"""

_common_kinds = ("line", "bar", "barh", "kde", "density", "area", "hist", "box")
Expand Down