Skip to content

fix obscure pandas bug #230

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

Merged
merged 1 commit into from
Oct 13, 2022
Merged

fix obscure pandas bug #230

merged 1 commit into from
Oct 13, 2022

Conversation

austinjpaul
Copy link
Contributor

Requesting historical data for August 2018, e.g. would not work because pandas decided to return an Index instead of a DateTimeIndex.
This should fix that by manually coercing it.

>>> cal = USFederalHolidayCalendar()
>>> cal.holidays(start=datetime.date(2021,8,1), end=datetime.date(2021,8,31))
DatetimeIndex([], dtype='datetime64[ns]', freq=None)
>>> cal.holidays(start=datetime.date(2020,8,1), end=datetime.date(2020,8,31))
DatetimeIndex([], dtype='datetime64[ns]', freq=None)
>>> cal.holidays(start=datetime.date(2019,8,1), end=datetime.date(2019,8,31))
DatetimeIndex([], dtype='datetime64[ns]', freq=None)
>>> cal.holidays(start=datetime.date(2018,8,1), end=datetime.date(2018,8,31))
Index([], dtype='object')

Copy link
Contributor

@friendchris friendchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this bug and I love finding it.

@austinjpaul
Copy link
Contributor Author

Filed with pandas: pandas-dev/pandas#49075

@austinjpaul austinjpaul merged commit ce01eeb into main Oct 13, 2022
@roadswitcher
Copy link

I love this bug and I love finding it.

It was hilarious fun to walk thru the pandas codebase to find this.

pandas PR should be merged soonish.

@PatrickCleary PatrickCleary deleted the holiday_fix branch March 28, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants