Skip to content

BUG: output of pandas.util.hash_pandas_object() changed in pandas 2.2.x #58999

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

Closed
2 of 3 tasks
hagenw opened this issue Jun 13, 2024 · 2 comments
Closed
2 of 3 tasks

BUG: output of pandas.util.hash_pandas_object() changed in pandas 2.2.x #58999

hagenw opened this issue Jun 13, 2024 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@hagenw
Copy link

hagenw commented Jun 13, 2024

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

import pandas as pd

index = pd.Index([0, 1, 2], dtype="Int64")  # without `dtype="Int64"` the bug doesn't appear
df = pd.DataFrame([0, 1, 2], index=index)
pd.util.hash_pandas_object(df)

Issue Description

Under pandas 2.1.0 we get:

0    17186048303505514001
1    10757116890508915594
2    14391254723460080955
dtype: uint64

Under pandas 2.2.0 and 2.2.2 we get:

0    3713087409444908179
1    7554402398462747209
2    1687604933839263903
dtype: uint64

Expected Behavior

Hashing should always return the same values, independent of the used pandas version.

Installed Versions

INSTALLED VERSIONS

commit : d9cdd2e
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 6.5.0-1023-oem
Version : #24-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 14:26:31 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.2 [7/2907]
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : 59.6.0
pip : 22.0.2
Cython : None
pytest : 8.1.1
hypothesis : None
sphinx : 5.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.24.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
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 : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@hagenw hagenw added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 13, 2024
@mroeschke
Copy link
Member

Thanks for the report, but this was (unfortunately) an intended change noted in the release notes: https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#other-api-changes so closing as an expected change

@hagenw
Copy link
Author

hagenw commented Jun 13, 2024

Ah, thanks, I overlooked this. It's also a big change for a minor version, as hashes might be used for caching. But it's ok, it might be anyway a better approach to not rely on pandas.utils.hash_pandas_object() for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants