From 5ae526b80f1be41f81171db8d5b657e3757540ff Mon Sep 17 00:00:00 2001 From: Jonas Bergner Date: Sat, 24 Feb 2024 17:07:41 +0100 Subject: [PATCH 1/4] Add description to Index._to_numpy method. --- pandas/core/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/core/base.py b/pandas/core/base.py index 7a3d6cb866ea5..4556b9ab4d4c9 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -566,6 +566,8 @@ def to_numpy( Returns ------- numpy.ndarray + The NumPy ndarray holding the values from this Series or Index. + The dtype of the array may differ. See Notes. See Also -------- From a327a457f7a629247461551017f74c9e6d32af42 Mon Sep 17 00:00:00 2001 From: Jonas Bergner Date: Sat, 24 Feb 2024 17:18:39 +0100 Subject: [PATCH 2/4] Fix description of default value for parameter "ordered" in set_categories --- pandas/core/arrays/categorical.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 886fe4594c17b..4146926c20f8a 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1071,7 +1071,7 @@ def set_categories( ---------- new_categories : Index-like The categories in new order. - ordered : bool, default False + ordered : bool, default None Whether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information. rename : bool, default False @@ -1080,7 +1080,8 @@ def set_categories( Returns ------- - Categorical with reordered categories. + Categorical + Raises ------ From 45b635da484d91cda43c5f1c90d864a3a170ce76 Mon Sep 17 00:00:00 2001 From: Jonas Bergner Date: Sat, 24 Feb 2024 17:37:36 +0100 Subject: [PATCH 3/4] Add description to return value of Categorical.set_categories and fix typo in description. --- pandas/core/arrays/categorical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 4146926c20f8a..49b8ba4c47811 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1064,7 +1064,7 @@ def set_categories( On the other hand this methods does not do checks (e.g., whether the old categories are included in the new categories on a reorder), which can result in surprising changes, for example when using special string - dtypes, which does not considers a S1 string equal to a single char + dtypes, which do not consider a S1 string equal to a single char python string. Parameters @@ -1081,7 +1081,7 @@ def set_categories( Returns ------- Categorical - + New categories to be used, with optional ordering changes. Raises ------ From 914e94d8f0212819236512eebc4197e8bd93d2bf Mon Sep 17 00:00:00 2001 From: Jonas Bergner Date: Sat, 24 Feb 2024 17:43:40 +0100 Subject: [PATCH 4/4] Remove fixed docstrings from code_checks.sh --- ci/code_checks.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index f1e7f6d477906..47a2cf93a4f89 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -1882,8 +1882,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then MSG='Partially validate docstrings (RT03)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT03 --ignore_functions \ - pandas.Index.to_numpy\ - pandas.Categorical.set_categories\ pandas.CategoricalIndex.set_categories\ pandas.DataFrame.astype\ pandas.DataFrame.at_time\