Skip to content

Commit 5d4af24

Browse files
committed
BUG: assert_index_equal CategoricalIndex incomparable categories gives AssertionError
1 parent b99e6d2 commit 5d4af24

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,10 @@ Bug fixes
933933
Categorical
934934
^^^^^^^^^^^
935935
- Bug in :func:`Series.apply` where ``nan`` was ignored for :class:`CategoricalDtype` (:issue:`59938`)
936-
- Bug in :meth:`Categorical.astype` where ``copy=False`` would still trigger a copy of the codes (:issue:`62000`)
936+
- Bug in :func:`testing.assert_index_equal` raising ``TypeError`` instead of ``AssertionError`` for incomparable ``CategoricalIndex`` when ``check_categorical=True`` and ``exact=False`` (:issue:`61935`)
937937
- Bug in :meth:`DataFrame.pivot` and :meth:`DataFrame.set_index` raising an ``ArrowNotImplementedError`` for columns with pyarrow dictionary dtype (:issue:`53051`)
938938
- 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`)
939-
- Bug in :func:`testing.assert_index_equal` raising ``TypeError`` instead of ``AssertionError`` for incomparable ``CategoricalIndex`` when ``check_categorical=True`` and ``exact=False`` (:issue:`61935`)
940-
-
939+
-
941940

942941
Datetimelike
943942
^^^^^^^^^^^^

pandas/_testing/asserters.py

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

0 commit comments

Comments
 (0)