Skip to content

BUG: Error raised accessing tuple value in Series when index contains duplicates #37800

Open
@rhshadrach

Description

@rhshadrach

E.g.

s = pd.Series([1, 1], index=[(1, 1), (1, 1)])
s[(1, 1)]

raises KeyError: (1, 1). Within pandas._libs.index.IndexEngine._get_loc_duplicates, we're using ndarray.searchsorted which interprets the tuple as an array-like of values to search for rather than a single tuple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesSeriesSeries data structure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions