Skip to content

Commit 19ed92a

Browse files
BUG: Fix bug with DataFrame.pivot and .set_index not compatible with pyarrow dictionary categoricals
Relates to pandas-dev#53051 Code for fix taken and adapted from pandas-dev#59099
1 parent dc8401a commit 19ed92a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def __init__(
452452
if isinstance(values, Index):
453453
arr = values._data._pa_array.combine_chunks()
454454
else:
455-
arr = values._pa_array.combine_chunks()
455+
arr = extract_array(values)._pa_array.combine_chunks()
456456
categories = arr.dictionary.to_pandas(types_mapper=ArrowDtype)
457457
codes = arr.indices.to_numpy()
458458
dtype = CategoricalDtype(categories, values.dtype.pyarrow_dtype.ordered)

0 commit comments

Comments
 (0)