Skip to content

Conversation

@mroeschke
Copy link
Member

If the flaky lottery is won and the random categories are not unique can raise

ImportError while loading conftest 'D:\a\1\s\pandas\conftest.py'.
pandas\conftest.py:564: in <module>
    "categorical": tm.makeCategoricalIndex(100),
pandas\_testing\__init__.py:310: in makeCategoricalIndex
    Categorical.from_codes(np.arange(k) % n, categories=x), name=name, **kwargs
pandas\core\arrays\categorical.py:678: in from_codes
    dtype = CategoricalDtype._from_values_or_dtype(
pandas\core\dtypes\dtypes.py:298: in _from_values_or_dtype
    dtype = CategoricalDtype(categories, ordered)
pandas\core\dtypes\dtypes.py:185: in __init__
    self._finalize(categories, ordered, fastpath=False)
pandas\core\dtypes\dtypes.py:339: in _finalize
    categories = self.validate_categories(categories, fastpath=fastpath)
pandas\core\dtypes\dtypes.py:536: in validate_categories
    raise ValueError("Categorical categories must be unique")
E   ValueError: Categorical categories must be unique

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Mar 19, 2022
@mroeschke mroeschke added this to the 1.5 milestone Mar 19, 2022
@jreback jreback added the Categorical Categorical Data Type label Mar 19, 2022
@jreback jreback merged commit 2a02ddb into pandas-dev:main Mar 19, 2022
@mroeschke mroeschke mentioned this pull request Mar 19, 2022
2 tasks
@mroeschke mroeschke deleted the tst/categoricalindex branch May 19, 2022 03:02
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Categorical Categorical Data Type Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants