From dde20f970c7c11d3547462635a4dcfb3663b8207 Mon Sep 17 00:00:00 2001 From: Jordan Murphy <35613487+jordan-d-murphy@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:13:25 -0700 Subject: [PATCH] DOC: fixing PR01 errors for pandas.Categorical and pandas.Categorical.__array__ (#57561) * fixing PR01 errors for pandas.Categorical and pandas.Categorical.__array__ * updated dtype to np.dtype Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --------- Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- 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 6469f39e7c332..f1e7f6d477906 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -1458,8 +1458,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..886fe4594c17b 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 : np.dtype or None + Specifies the the dtype for the array. + Returns ------- numpy.array