Skip to content

DOC: converting Index object with duplicate entries into a set #46440

Closed
@kwhkim

Description

@kwhkim

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

from https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#selecting-random-samples,
in section "Index objects", it reads "The pandas Index class and its subclasses can be viewed as implementing an ordered multiset. Duplicates are allowed. However, if you try to convert an Index object with duplicate entries into a set, an exception will be raised."

Documentation problem

from https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#selecting-random-samples,
in section "Index objects", it reads "The pandas Index class and its subclasses can be viewed as implementing an ordered multiset. Duplicates are allowed. However, if you try to convert an Index object with duplicate entries into a set, an exception will be raised."

but as I tried the below,

i = pd.Index(['a', 'b', 'a'])
set(i)
## {'a', 'b'}

it just works fine.

Suggested fix for documentation

it does not raise an exception... :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions