Skip to content

BUG: Index doesn't take over the Categorical name #10482

Closed
@sinhrks

Description

@sinhrks

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')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions