Skip to content

Allowing the index to be referenced by name, like a column #8162

Closed
@makmanalp

Description

@makmanalp

What if we allowed the index of a dataframe to be referred to in the usual ways?

data = pd.read_table("...", index_col="id")
data.id  # breaks
data["id"]  # breaks

I find myself setting and resetting indices very often to join to a different dataframe or to pull in the values of the index to a subselection of the dataframe, etc. I figure this is because of how the data is stored under the hood, but wouldn't this be convenient?

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIndexingRelated 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