Skip to content

Commit 0946a56

Browse files
authored
DOC: Fixing EX01 - Added examples (#54162)
backfill, pad, hist, plot
1 parent e8f23fb commit 0946a56

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

ci/code_checks.sh

-5
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
6363

6464
MSG='Partially validate docstrings (EX01)' ; echo $MSG
6565
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \
66-
pandas.Series.backfill \
67-
pandas.Series.pad \
68-
pandas.Series.hist \
6966
pandas.errors.AccessorRegistrationWarning \
7067
pandas.errors.AttributeConflictWarning \
7168
pandas.errors.DataError \
@@ -138,8 +135,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
138135
pandas.api.extensions.ExtensionArray.ndim \
139136
pandas.api.extensions.ExtensionArray.shape \
140137
pandas.api.extensions.ExtensionArray.tolist \
141-
pandas.DataFrame.pad \
142-
pandas.DataFrame.plot \
143138
pandas.DataFrame.to_gbq \
144139
pandas.DataFrame.__dataframe__
145140
RET=$(($RET + $?)) ; echo $MSG "DONE"

pandas/core/generic.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -7391,6 +7391,10 @@ def pad(
73917391
-------
73927392
{klass} or None
73937393
Object with missing values filled or None if ``inplace=True``.
7394+
7395+
Examples
7396+
--------
7397+
Please see examples for :meth:`DataFrame.ffill` or :meth:`Series.ffill`.
73947398
"""
73957399
warnings.warn(
73967400
"DataFrame.pad/Series.pad is deprecated. Use "
@@ -7527,7 +7531,7 @@ def backfill(
75277531
75287532
Examples
75297533
--------
7530-
Please see examples for :meth:`DataFrame.bfill`.
7534+
Please see examples for :meth:`DataFrame.bfill` or :meth:`Series.bfill`.
75317535
"""
75327536
warnings.warn(
75337537
"DataFrame.backfill/Series.backfill is deprecated. Use "

pandas/plotting/_core.py

+31-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ def hist_series(
103103
104104
Examples
105105
--------
106+
For Series:
107+
108+
.. plot::
109+
:context: close-figs
110+
111+
>>> lst = ['a', 'a', 'a', 'b', 'b', 'b']
112+
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
113+
>>> hist = ser.hist()
114+
115+
For Groupby:
106116
107117
.. plot::
108118
:context: close-figs
@@ -790,23 +800,41 @@ class PlotAccessor(PandasObject):
790800
791801
Examples
792802
--------
793-
For SeriesGroupBy:
803+
For Series:
794804
795805
.. plot::
796806
:context: close-figs
797807
798808
>>> ser = pd.Series([1, 2, 3, 3])
799809
>>> plot = ser.plot(kind='hist', title="My plot")
800810
801-
For DataFrameGroupBy:
811+
For DataFrame:
802812
803813
.. plot::
804814
:context: close-figs
805815
806816
>>> df = pd.DataFrame({'length': [1.5, 0.5, 1.2, 0.9, 3],
807817
... 'width': [0.7, 0.2, 0.15, 0.2, 1.1]},
808818
... index=['pig', 'rabbit', 'duck', 'chicken', 'horse'])
809-
>>> plot = df.plot()
819+
>>> plot = df.plot(title="DataFrame Plot")
820+
821+
For SeriesGroupBy:
822+
823+
.. plot::
824+
:context: close-figs
825+
826+
>>> lst = [-1, -2, -3, 1, 2, 3]
827+
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
828+
>>> plot = ser.groupby(lambda x: x > 0).plot(title="SeriesGroupBy Plot")
829+
830+
For DataFrameGroupBy:
831+
832+
.. plot::
833+
:context: close-figs
834+
835+
>>> df = pd.DataFrame({"col1" : [1, 2, 3, 4],
836+
... "col2" : ["A", "B", "A", "B"]})
837+
>>> plot = df.groupby("col2").plot(kind="bar", title="DataFrameGroupBy Plot")
810838
"""
811839

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

0 commit comments

Comments
 (0)