CategoricalIndex.equals incorrectly considers category order when unordered · Issue #16603 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@TomAugspurger

Description

@TomAugspurger

import pandas as pd pd.CategoricalIndex(['a', 'b'], categories=['a', 'b']).equals( ... pd.CategoricalIndex(['a', 'b'], categories=['b', 'a'])) False

I fixed this for regular Categoricals in #16339, but that didn't affect CategoricalIndex.equals. Do we want .equals to ignore order when ordered=False on both (I think we do)?

Discovered during my CategoricalDtype refactor, which does fix it so that order is ignored when order=False.