Skip to content

Commit

Permalink
GH-35025: [Python] Remove use of deprecated pandas.Categorical fastpa…
Browse files Browse the repository at this point in the history
…th keyword (#35026)

### Rationale for this change
We are using `pd.Categorical(codes, categories, fastpath=True)`. This keyword is deprecated in pandas 2.1 and this should be changed to `pd.Categorical.from_codes(codes, categories)`.

### Are there any user-facing changes?
No
* Closes: #35025

Authored-by: Joris Van den Bossche <[email protected]>
Signed-off-by: Joris Van den Bossche <[email protected]>
  • Loading branch information
jorisvandenbossche authored Apr 11, 2023
1 parent 61b89df commit e488942
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1685,10 +1685,9 @@ cdef wrap_array_output(PyObject* output):
cdef object obj = PyObject_to_object(output)

if isinstance(obj, dict):
return pandas_api.categorical_type(obj['indices'],
categories=obj['dictionary'],
ordered=obj['ordered'],
fastpath=True)
return _pandas_api.categorical_type.from_codes(
obj['indices'], categories=obj['dictionary'], ordered=obj['ordered']
)
else:
return obj

Expand Down

0 comments on commit e488942

Please sign in to comment.