Pandas version checks

  • [X] 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... :(

Comment From: rhshadrach

Thanks for the report @kwhkim. It looks to me like the offending sentence "However, if you try... an exception will be raised" can be removed. Would you be interesting in submitting a PR to fix?

Comment From: rhshadrach

Also - can you make the title of this issue more informative.

Comment From: kwhkim

Sure, will do in a day or so :)