From 31d195e3b4ff128216e6011b2a8f24a9fd39be46 Mon Sep 17 00:00:00 2001 From: Jordan Murphy <35613487+jordan-d-murphy@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:40:06 -0700 Subject: [PATCH 1/2] fixing PR01 errors for pandas.Categorical and pandas.Categorical.__array__ --- ci/code_checks.sh | 2 -- pandas/core/arrays/categorical.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 04c3ff3a42971..7c3cbeff92be2 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -1459,8 +1459,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then MSG='Partially validate docstrings (PR01)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=PR01 --ignore_functions \ - pandas.Categorical\ - pandas.Categorical.__array__\ pandas.CategoricalIndex.equals\ pandas.CategoricalIndex.map\ pandas.DataFrame.at_time\ diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index d1dba024e85c5..adb90ba0819ab 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -276,6 +276,11 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi provided). dtype : CategoricalDtype An instance of ``CategoricalDtype`` to use for this categorical. + fastpath : bool + The 'fastpath' keyword in Categorical is deprecated and will be + removed in a future version. Use Categorical.from_codes instead. + copy : bool, default True + Whether to copy if the codes are unchanged. Attributes ---------- @@ -1657,6 +1662,11 @@ def __array__(self, dtype: NpDtype | None = None) -> np.ndarray: """ The numpy array interface. + Parameters + ---------- + dtype : NpDtype or None + Specifies the the dtype for the array. + Returns ------- numpy.array From 36fd77899b0d0e5ecdec939f6ff5dd4f5a6f0d6f Mon Sep 17 00:00:00 2001 From: Jordan Murphy <35613487+jordan-d-murphy@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:34:55 -0700 Subject: [PATCH 2/2] updated dtype to np.dtype Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- 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 adb90ba0819ab..886fe4594c17b 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1664,7 +1664,7 @@ def __array__(self, dtype: NpDtype | None = None) -> np.ndarray: Parameters ---------- - dtype : NpDtype or None + dtype : np.dtype or None Specifies the the dtype for the array. Returns