Skip to content

Series.loc[list] with uint64 keys returns a dataframe with Float64Index #28279

Closed
@oguzhanogreden

Description

@oguzhanogreden

Code Sample, a copy-pastable example if possible

bug = pd.Series([0, 1, 2, 3, 4], index=[7606741985629028552, 17876870360202815256, 13106359306506049338, 8991270399732411471, 8991270399732411472])
assert bug.loc[7606741985629028552]==0
assert bug.loc[17876870360202815256]==1

bug.loc[[7606741985629028552, 17876870360202815256]].index

Problem description

The above selection should not have the side effect of modifying data types. I noticed this while looking at #28023 but I think this is a separate issue, so I'm documenting it separately.

Output of pd.show_versions()

[Same with #28023, I'll update this when I have my laptop at hand.]

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions