-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
This is a follow-up issue to #13854.
Code Sample, a copy-pastable example if possible
cidx = pd.CategoricalIndex(['y', 'x'], categories=list("xyz"), ordered=True)
df = pd.DataFrame([[10, 11, 12]])
pd.concat([df, df], keys=cidx).index.levels[0]
Out[32]: Index(['y', 'x'], dtype='object')
Expected Output
CategoricalIndex(['y', 'x'], categories=['x', 'y', 'z'], ordered=True, dtype='category')
I decided to put it separately because a fix requires more changes than just a factorization introduced in #13854.
Metadata
Metadata
Assignees
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode