We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bcd303 commit 1e4e2f4Copy full SHA for 1e4e2f4
pandas/core/arrays/categorical.py
@@ -447,7 +447,12 @@ def __init__(
447
if isinstance(values.dtype, ArrowDtype) and issubclass(
448
values.dtype.type, CategoricalDtypeType
449
):
450
- arr = values._pa_array.combine_chunks()
+ from pandas import Index
451
+
452
+ if isinstance(values, Index):
453
+ arr = values._data._pa_array.combine_chunks()
454
+ else:
455
+ arr = values._pa_array.combine_chunks()
456
categories = arr.dictionary.to_pandas(types_mapper=ArrowDtype)
457
codes = arr.indices.to_numpy()
458
dtype = CategoricalDtype(categories, values.dtype.pyarrow_dtype.ordered)
0 commit comments