BUG: assert_frame_equal() with check_like=True errors with non-comparable types #39168
Closed
2 of 3 tasks
Labels
Regression
Functionality that used to work in a prior pandas version
Testing
pandas testing functions or related to the test suite
Milestone
Code sample
Problem description
This code raises:
The cause is PR #37479, which added the following to
assert_index_equal()
:This is code is triggered by
assert_frame_equal(…, check_like=True)
..sort_order()
does not work when an index contains non-comparable types, likestr
andint
.Detected via iiasa/ixmp#390.
Expected output
In pandas < 1.2.0, the last line above returned
True
.The description of the
check_like
argument is:pandas/pandas/_testing/asserters.py
Lines 1127 to 1130 in 25110a9
…i.e. this does not indicate that the columns index may only contain comparable types, so the function should not raise an exception.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 3e89b4c
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-36-generic
Version : #40-Ubuntu SMP Tue Jan 5 21:54:35 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_CA.UTF-8
LOCALE : en_CA.UTF-8
pandas : 1.2.0
numpy : 1.19.4
pytz : 2020.1
dateutil : 2.8.1
pip : 20.3.3
setuptools : 50.3.2
Cython : 0.29.21
pytest : 6.1.2
hypothesis : None
sphinx : 3.3.0
blosc : 1.8.1
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.5.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : 1.3.2
fsspec : 0.6.1
fastparquet : None
gcsfs : None
matplotlib : 3.3.3
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.4
sqlalchemy : 1.3.19
tables : 3.6.1
tabulate : 0.8.6
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.51.2
The text was updated successfully, but these errors were encountered: