Skip to content

Implement CategoricalIndex #7629

Closed
@jankatins

Description

@jankatins

When #7217 becomes available, it would be nice to also have a 'CategoricalIndex' so that the sorting behaviour based on levels will be preserved when a categorical becomes a index:

cats = pd.Categorical([1,2,3,4], levels=[4,2,3,1])
strings = ["a","b","c","d"]
values = [4,2,3,1]
df = pd.DataFrame({"strings":strings, "values":values}, index=cats)
df.index
# This should sort by levels but does not as there is no CategoricalIndex!
df.sort_index()

CC: @shoyer

Metadata

Metadata

Assignees

No one assigned

    Labels

    CategoricalCategorical Data TypeEnhancementIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions