Skip to content

API: Add NDFrame property to disallow duplicates #27108

Closed
@TomAugspurger

Description

@TomAugspurger

edit: see #27108 (comment)


I'd like to be able to have an index, and ensure that no operation introduces duplicates.

idx = pd.Index(..., allow_duplicates=False)
s = pd.Series(..., index=idx)

From here, any pandas operation that introduces duplicates (e.g. s.loc[['a', 'a']]) would raise, rather than return an Index with two values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions