Description
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... :(