From 838f9001fd58d9a05006b34f3e56a929f594277e Mon Sep 17 00:00:00 2001 From: gboeker Date: Thu, 2 May 2024 14:10:41 -0400 Subject: [PATCH 1/5] add see also section for pandas.Series.cat --- pandas/core/arrays/categorical.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 11dea697d9b93..2fe32b9c2f158 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1310,7 +1310,7 @@ def add_categories(self, new_categories) -> Self: Parameters ---------- new_categories : category or list-like of category - The new categories to be included. + The new categories to be included. Returns ------- @@ -2864,6 +2864,11 @@ class CategoricalAccessor(PandasDelegate, PandasObject, NoNewAttributesMixin): ---------- data : Series or CategoricalIndex + See Also + -------- + Series.dt : Accessor object for datetimelike properties of the Series values. + Series.sparse : Accessor for SparseSparse from other sparse matrix data types. + Examples -------- >>> s = pd.Series(list("abbccc")).astype("category") From eadf1f7958dbc43ea091ebcff1b4261bb8bd52e7 Mon Sep 17 00:00:00 2001 From: gboeker Date: Thu, 2 May 2024 14:29:33 -0400 Subject: [PATCH 2/5] fix docstring errors for pandas.Series.__iter__ --- ci/code_checks.sh | 3 +-- pandas/core/base.py | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 996f361e9440f..61d1bc8abefae 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -166,11 +166,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.RangeIndex.step SA01" \ -i "pandas.RangeIndex.stop SA01" \ -i "pandas.Series SA01" \ - -i "pandas.Series.__iter__ RT03,SA01" \ -i "pandas.Series.add PR07" \ -i "pandas.Series.backfill PR01,SA01" \ -i "pandas.Series.case_when RT03" \ - -i "pandas.Series.cat PR07,SA01" \ + -i "pandas.Series.cat PR07" \ -i "pandas.Series.cat.add_categories PR01,PR02" \ -i "pandas.Series.cat.as_ordered PR01" \ -i "pandas.Series.cat.as_unordered PR01" \ diff --git a/pandas/core/base.py b/pandas/core/base.py index 87e87538ca1d9..fbe8acdb6f211 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -870,6 +870,13 @@ def __iter__(self) -> Iterator: Returns ------- iterator + An iterator yielding scalar values from the Series. + + See Also + -------- + pandas.Series.items : Lazily iterate over (index, value) tuples. + pandas.Series.index : The index (axis labels) of the Series. + pandas.Series.apply : Invoke function on values of Series. Examples -------- From e87050d36dbf0bfd7b1ca194dc246418c3ce3389 Mon Sep 17 00:00:00 2001 From: gboeker <68177766+gboeker@users.noreply.github.com> Date: Thu, 2 May 2024 17:12:16 -0400 Subject: [PATCH 3/5] remove 'pandas' from see also --- pandas/core/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/base.py b/pandas/core/base.py index fbe8acdb6f211..8582fa302c8a3 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -874,9 +874,9 @@ def __iter__(self) -> Iterator: See Also -------- - pandas.Series.items : Lazily iterate over (index, value) tuples. - pandas.Series.index : The index (axis labels) of the Series. - pandas.Series.apply : Invoke function on values of Series. + Series.items : Lazily iterate over (index, value) tuples. + Series.index : The index (axis labels) of the Series. + Series.apply : Invoke function on values of Series. Examples -------- From 138553863e1c92e9d3a03540a1fcc6a402951e48 Mon Sep 17 00:00:00 2001 From: gboeker <68177766+gboeker@users.noreply.github.com> Date: Thu, 2 May 2024 19:05:16 -0400 Subject: [PATCH 4/5] Improve See Also Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/core/base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandas/core/base.py b/pandas/core/base.py index 8582fa302c8a3..07a7f784b600e 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -875,8 +875,6 @@ def __iter__(self) -> Iterator: See Also -------- Series.items : Lazily iterate over (index, value) tuples. - Series.index : The index (axis labels) of the Series. - Series.apply : Invoke function on values of Series. Examples -------- From b3f9d42a33c62261581b9e44c55a7dec60a9f62b Mon Sep 17 00:00:00 2001 From: gboeker <68177766+gboeker@users.noreply.github.com> Date: Thu, 2 May 2024 19:56:22 -0400 Subject: [PATCH 5/5] Improve See Also --- pandas/core/arrays/categorical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 9b5199085180d..381eaaa167d42 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2867,7 +2867,7 @@ class CategoricalAccessor(PandasDelegate, PandasObject, NoNewAttributesMixin): See Also -------- Series.dt : Accessor object for datetimelike properties of the Series values. - Series.sparse : Accessor for SparseSparse from other sparse matrix data types. + Series.sparse : Accessor for sparse matrix data types. Examples --------