Skip to content

Commit ba656b6

Browse files
committed
checked class of values before combine_chunks()
1 parent a4fc97e commit ba656b6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/arrays/categorical.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,10 @@ def __init__(
447447
if isinstance(values.dtype, ArrowDtype) and issubclass(
448448
values.dtype.type, CategoricalDtypeType
449449
):
450-
arr = values._pa_array.combine_chunks()
450+
if values.__class__.__name__ == 'Index':
451+
arr = values._data._pa_array.combine_chunks()
452+
else:
453+
arr = values._pa_array.combine_chunks()
451454
categories = arr.dictionary.to_pandas(types_mapper=ArrowDtype)
452455
codes = arr.indices.to_numpy()
453456
dtype = CategoricalDtype(categories, values.dtype.pyarrow_dtype.ordered)

0 commit comments

Comments
 (0)