Skip to content

BUG: pd.testing.assert_frame_equal does not propagate precision to interval dtype #43913

Open
@stephanegaiffas

Description

@stephanegaiffas

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

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

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

Reproducible Example

df1 = pd.DataFrame()
df1[0] = pd.arrays.IntervalArray.from_tuples([(1.0, 2.0)])

df2 = pd.DataFrame()
df2[0] = pd.arrays.IntervalArray.from_tuples([(1.0000000000001, 2.0)])

# Using very large tolerances do not propagate to the interval dtype, since this assert fails:
pd.testing.assert_frame_equal(df1, df2, check_exact=False, rtol=10., atol=10.)

Issue Description

It seems that pd.testing.assert_frame_equal does not propagate chosen tolerances for interval dtype comparison.

Expected Behavior

df1 = pd.DataFrame()
df1[0] = pd.arrays.IntervalArray.from_tuples([(1.0, 2.0)])
df2 = pd.DataFrame()
df2[0] = pd.arrays.IntervalArray.from_tuples([(1.0000000000001, 2.0)])

This test should pass...

pd.testing.assert_frame_equal(df1, df2, check_exact=False, rtol=10., atol=10.)

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2cb9652 python : 3.8.8.final.0 python-bits : 64 OS : Darwin OS-release : 20.5.0 Version : Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : fr_FR.UTF-8 LOCALE : fr_FR.UTF-8

pandas : 1.2.4
numpy : 1.20.1
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0.post20210125
Cython : 0.29.23
pytest : 6.2.3
hypothesis : None
sphinx : 4.0.1
blosc : None
feather : None
xlsxwriter : 1.3.8
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.22.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.9.0
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.2
sqlalchemy : 1.4.7
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
numba : 0.53.1

Metadata

Metadata

Assignees

Labels

BugExtensionArrayExtending pandas with custom dtypes or arrays.IntervalInterval data typeTestingpandas testing functions or related to the test suite

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions