BUG: differing syntax for datetime column dtype specification causes failure with assert_frame_equal()
#57644
Closed
3 tasks done
Pandas version checks
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 main branch of pandas.
Reproducible Example
Issue Description
As far as I'm aware, the
assert_frame_equal()
in the above example shouldn't fail but it thinks the dtypes are different:Both an eyeball check and using
df.compare()
suggests the data itself is the same. Checking the dtype, and type of the dtype, looks the same too, e.g.produces
However it fails with
assert_frame_equal()
.Expected Behavior
That the dtype specified by the different syntax(es)
dtype=pd.DatetimeTZDtype(tz=ZoneInfo("Europe/Paris")
vsdtype="datetime64[ns, Europe/Paris]"
shouldn't causeassert_frame_equal()
to fail for the associated column.Unless I've badly misunderstood expected behaviour, which is quite possible.
Installed Versions
INSTALLED VERSIONS
commit : f538741
python : 3.11.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-97-generic
Version : #107~20.04.1-Ubuntu SMP Fri Feb 9 14:20:11 UTC 2024
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 2.2.0
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.8.2
setuptools : 69.1.0
pip : 24.0
Cython : None
pytest : 8.0.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.21.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : 2023.10.1
fsspec : 2024.2.0
gcsfs : None
matplotlib : None
numba : None
numexpr : 2.9.0
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 15.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : 2.0.1
zstandard : 0.22.0
tzdata : 2024.1
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: