Skip to content

Commit 0ef7755

Browse files
committed
BUG: assert_index_equal CategoricalIndex incomparable categories gives AssertionError
1 parent 02ffdfb commit 0ef7755

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,10 @@ Bug fixes
687687
Categorical
688688
^^^^^^^^^^^
689689
- Bug in :func:`Series.apply` where ``nan`` was ignored for :class:`CategoricalDtype` (:issue:`59938`)
690+
- Bug in :func:`testing.assert_index_equal` raising ``TypeError`` instead of ``AssertionError`` for incomparable ``CategoricalIndex`` when ``check_categorical=True`` and ``exact=False`` (:issue:`61935`)
690691
- Bug in :meth:`DataFrame.pivot` and :meth:`DataFrame.set_index` raising an ``ArrowNotImplementedError`` for columns with pyarrow dictionary dtype (:issue:`53051`)
691692
- Bug in :meth:`Series.convert_dtypes` with ``dtype_backend="pyarrow"`` where empty :class:`CategoricalDtype` :class:`Series` raised an error or got converted to ``null[pyarrow]`` (:issue:`59934`)
692-
- Bug in :func:`testing.assert_index_equal` raising ``TypeError`` instead of ``AssertionError`` for incomparable ``CategoricalIndex`` when ``check_categorical=True`` and ``exact=False`` (:issue:`61935`)
693-
-
693+
-
694694

695695
Datetimelike
696696
^^^^^^^^^^^^

pandas/_testing/asserters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ def _check_types(left, right, obj: str = "Index") -> None:
322322
# skip exact index checking when `check_categorical` is False
323323
elif check_exact and check_categorical:
324324
if not left.equals(right):
325-
# _values compare can raise TypeError for non-comparable categoricals (GH#61935)
325+
# _values compare can raise TypeError (non-comparable
326+
# categoricals (GH#61935)
326327
try:
327328
mismatch = left._values != right._values
328329
except TypeError:

0 commit comments

Comments
 (0)