Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: pd.testing.assert_frame_equal(..., check_exact=True) raises AssertionError when comparing numeric ExtensionDtypes #39410

Closed
2 of 3 tasks
apriha opened this issue Jan 26, 2021 · 1 comment · Fixed by #39423
Labels
Bug Regression Functionality that used to work in a prior pandas version Testing pandas testing functions or related to the test suite
Milestone

Comments

@apriha
Copy link

apriha commented Jan 26, 2021

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd

d = {"x": [1, 2]}

df1 = pd.DataFrame(data=d, dtype=pd.UInt32Dtype())
df2 = pd.DataFrame(data=d, dtype=pd.UInt32Dtype())

pd.testing.assert_frame_equal(df1, df2, check_exact=True)

Problem description

The above code raises the following exception:

AssertionError: ndarray Expected type <class 'numpy.ndarray'>, found <class 'pandas.core.arrays.integer.IntegerArray'> instead

Instead, the usage of pd.testing.assert_frame_equal(..., check_exact=True) should not raise an exception when comparing numeric ExtensionDtypes.

Expected Output

No exception.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 9d598a5
python : 3.8.7.final.0
python-bits : 64
OS : Darwin
OS-release : 17.7.0
Version : Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.2.1
numpy : 1.19.5
pytz : 2020.5
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@apriha apriha added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 26, 2021
simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this issue Jan 26, 2021
@simonjayhawkins
Copy link
Member

code sample working in 1.0.5

first bad commit: [08c6597] CLN: remove check_series_type (#32513) cc @jbrockmendel

@simonjayhawkins simonjayhawkins added Regression Functionality that used to work in a prior pandas version Testing pandas testing functions or related to the test suite and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 26, 2021
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Jan 26, 2021
@jreback jreback modified the milestones: Contributions Welcome, 1.2.2 Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression Functionality that used to work in a prior pandas version Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants