From 72594ba9c33eccd7df486c0a95d0b00c5c35a3ac Mon Sep 17 00:00:00 2001 From: Trinh Quoc Anh Date: Tue, 16 Jan 2024 09:21:34 +0100 Subject: [PATCH] DOC: fix EX03 errors in docstrings (#56855) --- ci/code_checks.sh | 2 +- pandas/core/arrays/datetimes.py | 5 ++++- pandas/core/indexes/base.py | 3 ++- pandas/core/indexes/multi.py | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 7d1370dc00c91..c0dfbcc03b473 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -88,7 +88,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.io.formats.style.Styler.background_gradient \ pandas.io.formats.style.Styler.text_gradient \ pandas.DataFrame.plot.hexbin \ - pandas.DataFrame.plot.line \ + pandas.DataFrame.plot.line RET=$(($RET + $?)) ; echo $MSG "DONE" fi diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index cd6689e9f1ce2..e251bd28245e7 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -213,7 +213,10 @@ class DatetimeArray(dtl.TimelikeOps, dtl.DatelikeOps): # type: ignore[misc] Examples -------- >>> pd.arrays.DatetimeArray._from_sequence( - ... pd.DatetimeIndex(['2023-01-01', '2023-01-02'], freq='D')) + ... pd.DatetimeIndex( + ... ["2023-01-01", "2023-01-02"], freq="D" + ... ) + ... ) ['2023-01-01 00:00:00', '2023-01-02 00:00:00'] Length: 2, dtype: datetime64[ns] diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index a2666cd6cb229..1663a5a78225f 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2124,7 +2124,8 @@ def droplevel(self, level: IndexLabel = 0): Examples -------- >>> mi = pd.MultiIndex.from_arrays( - ... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z']) + ... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z'] + ... ) >>> mi MultiIndex([(1, 3, 5), (2, 4, 6)], diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 25bcc1f307082..6bcfaa6d26fc2 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1638,7 +1638,8 @@ def _set_names(self, names, *, level=None, validate: bool = True) -> None: Examples -------- >>> mi = pd.MultiIndex.from_arrays( - ... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z']) + ... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z'] + ... ) >>> mi MultiIndex([(1, 3, 5), (2, 4, 6)],