From 612823e824805b97a2dbe258ba808dc572083d49 Mon Sep 17 00:00:00 2001 From: Zhengbo Wang <77875500+luke396@users.noreply.github.com> Date: Sat, 13 Jan 2024 01:59:24 +0800 Subject: [PATCH] DOC: Fix EX03 flake8 errors in docstrings (#56834) * Fix formatting in `pandas.Series.cat.set_categories` and `pandas.Series.plot.bar` * Remove unused code in code_checks.sh --------- Co-authored-by: Marc Garcia --- ci/code_checks.sh | 3 --- pandas/core/arrays/categorical.py | 2 +- pandas/plotting/_core.py | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 092681049f7f2..75b6925d14f21 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -71,9 +71,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then MSG='Partially validate docstrings (EX03)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX03 --ignore_functions \ - pandas.Series.cat.set_categories \ - pandas.Series.plot.bar \ - pandas.Series.plot.hist \ pandas.Series.plot.line \ pandas.Series.to_sql \ pandas.Series.to_latex \ diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 342aaad3f9adc..5a88aed1419e3 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1082,7 +1082,7 @@ def set_categories( For :class:`pandas.Series`: >>> raw_cat = pd.Categorical(['a', 'b', 'c', 'A'], - ... categories=['a', 'b', 'c'], ordered=True) + ... categories=['a', 'b', 'c'], ordered=True) >>> ser = pd.Series(raw_cat) >>> ser 0 a diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index cb5598a98d5af..96609fdc1671b 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -1114,7 +1114,7 @@ def line( .. plot:: :context: close-figs - >>> df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]}) + >>> df = pd.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]}) >>> ax = df.plot.bar(x='lab', y='val', rot=0) Plot a whole dataframe to a bar plot. Each column is assigned a @@ -1195,7 +1195,7 @@ def bar( # pylint: disable=disallowed-name """ See Also -------- - DataFrame.plot.bar: Vertical bar plot. + DataFrame.plot.bar : Vertical bar plot. DataFrame.plot : Make plots of DataFrame using matplotlib. matplotlib.axes.Axes.bar : Plot a vertical bar plot using matplotlib.