BUG: Index doesn't take over the Categorical name · Issue #10482 · pandas-dev/pandas (original) (raw)
Series
can take over the Categorical.name
.
import pandas as pd
c = pd.Categorical([1, 2, 3], name='xxx')
pd.Series(c)
#0 1
#1 2
#2 3
# Name: xxx, dtype: category
# Categories (3, int64): [1, 2, 3]
But Index
doesn't.
pd.Index(c)
# CategoricalIndex([1, 2, 3], categories=[1, 2, 3], ordered=False, dtype='category')
pd.CategoricalIndex(c)
# CategoricalIndex([1, 2, 3], categories=[1, 2, 3], ordered=False, dtype='category')