Skip to content

BUG: offsets are now unhashable #37267

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
dhirschfeld opened this issue Oct 19, 2020 · 0 comments · Fixed by #37288
Closed
2 of 3 tasks

BUG: offsets are now unhashable #37267

dhirschfeld opened this issue Oct 19, 2020 · 0 comments · Fixed by #37288
Labels
Frequency DateOffsets Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@dhirschfeld
Copy link
Contributor

dhirschfeld commented Oct 19, 2020

  • 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.


As discussed on gitter, this was apparently an unindended consequence of #34227

image
https://gitter.im/pydata/pandas?at=5f8d8a106c8d484be294872f

Code Sample, a copy-pastable example

>>> import pandas as pd
>>> hash(pd.offsets.Day())
Traceback (most recent call last):
  File "C:\Users\dhirschf\envs\dev\lib\site-packages\IPython\core\interactiveshell.py", line 3417, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-46-d78c0d3ee4ad>", line 1, in <module>
    hash(pd.offsets.Day())
TypeError: unhashable type: 'pandas._libs.tslibs.offsets.Day'

Problem description

My code relied on the hashability of offsets and so this broke my code and has so far prevented me upgrading to the latest pandas

Expected Output

Output of pd.show_versions()

>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit           : db08276bc116c438d3fdee492026f8223584c477
python           : 3.7.7.final.0
python-bits      : 64
OS               : Windows
OS-release       : 10
Version          : 10.0.17763
machine          : AMD64
processor        : Intel64 Family 6 Model 58 Stepping 0, GenuineIntel
byteorder        : little
LC_ALL           : None
LANG             : None
LOCALE           : None.None
pandas           : 1.1.3
numpy            : 1.19.1
pytz             : 2020.1
dateutil         : 2.8.1
pip              : 20.2.4
setuptools       : 50.3.0.post20201006
Cython           : 0.29.21
pytest           : 6.1.1
hypothesis       : 5.37.3
sphinx           : 3.2.1
blosc            : 1.9.2
feather          : None
xlsxwriter       : 1.3.7
lxml.etree       : 4.6.0
html5lib         : 1.1
pymysql          : 0.10.1
psycopg2         : 2.8.6 (dt dec pq3 ext lo64)
jinja2           : 2.11.2
IPython          : 7.18.1
pandas_datareader: None
bs4              : 4.9.3
bottleneck       : 1.3.2
fsspec           : 0.8.4
fastparquet      : None
gcsfs            : None
matplotlib       : 3.3.2
numexpr          : 2.7.1
odfpy            : None
openpyxl         : 3.0.5
pandas_gbq       : None
pyarrow          : 1.0.1
pytables         : None
pyxlsb           : None
s3fs             : None
scipy            : 1.5.2
sqlalchemy       : 1.3.20
tables           : 3.6.1
tabulate         : 0.8.7
xarray           : 0.16.1
xlrd             : 1.2.0
xlwt             : 1.3.0
numba            : 0.51.2

@dhirschfeld dhirschfeld added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 19, 2020
@jbrockmendel jbrockmendel added Frequency DateOffsets and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 19, 2020
@jorisvandenbossche jorisvandenbossche added Regression Functionality that used to work in a prior pandas version and removed Bug labels Oct 20, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.1.4 milestone Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants