Skip to content

BUG: USFederalHolidayCalendar().holiday() call fails before 2018 #54580

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
miel-jether opened this issue Aug 16, 2023 · 4 comments · Fixed by #54655
Closed
2 of 3 tasks

BUG: USFederalHolidayCalendar().holiday() call fails before 2018 #54580

miel-jether opened this issue Aug 16, 2023 · 4 comments · Fixed by #54655
Assignees
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@miel-jether
Copy link

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

from pandas import Timestamp
from pandas.tseries.holiday import USFederalHolidayCalendar

ts0 = Timestamp('2018-01-01', tz = 'America/Chicago')
ts1 = Timestamp('2018-01-11', tz = 'America/Chicago')
USFederalHolidayCalendar().holidays(ts0, ts1)

Issue Description

USFederalHolidayCalendar().holidays(start_date, end_date) raises an error if the time range queried is from 2018 or before. Namely, the TypeError: Invalid comparison between dtype=datetime64[ns] and Timestamp error is raised, caused by the call rule.dates(start, end, return_name=True) in tseries\holiday.py for the Juneteenth holiday.

This behaviour was seen in both Pandas 2.0.1 and 2.0.3.

Expected Behavior

A list of all the holidays in the time range should be outputted, with Juneteenth missing since it wasn't observed yet.

Installed Versions

commit : 37ea63d
python : 3.10.11.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_Israel.1252
pandas : 2.0.1
numpy : 1.24.3
pytz : 2023.3
dateutil : 2.8.2
setuptools : 57.5.0
pip : 22.3.1
Cython : 0.29.36
pytest : 7.3.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.1.2
lxml.etree : 4.9.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : 4.12.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2023.6.0
gcsfs : 2023.6.0
matplotlib : 3.7.2
numba : None
numexpr : 2.8.4
odfpy : None
openpyxl : 3.1.2
pandas_gbq : 0.19.2
pyarrow : 12.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.1
snappy : None
sqlalchemy : None
tables : 3.8.0
tabulate : None
xarray : 2023.6.0
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@miel-jether miel-jether added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 16, 2023
@roadswitcher
Copy link
Contributor

Interesting -- appears to have a timezone component to the bug.

If I remove the timezone from the Timestamp, it returns the expected one element list with New Years Day in it?

In [23]: ts0_notz = Timestamp('2018-01-01')

In [24]: ts1_notz = Timestamp('2018-01-11')

In [25]: USFederalHolidayCalendar().holidays(ts0_notz, ts1_notz)
Out[25]: DatetimeIndex(['2018-01-01'], dtype='datetime64[ns]', freq=None)

@roadswitcher
Copy link
Contributor

Thanks for reporting this -- it reminds me of #49075 .

@roadswitcher
Copy link
Contributor

take

@roadswitcher
Copy link
Contributor

Waiting for tests to pass in CI/CD

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

Successfully merging a pull request may close this issue.

2 participants