A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/11477 below:

Time Series / Date functionality Holiday lookup

When trying to confirm if a specific date is an observed holiday using the specific date for the start and end range, the attempt fails to confirm a known observed holiday. It works as expected if I change the end date. When I try to use the same start and end date again, it works every time.

In 2015, the July 4th holiday was observed on July 3rd. Since a BDay() offset ignores holidays, a confirmation of an observed holiday failed when using July 3, 2015 for the start and end dates. See code below:

from datetime import datetime
from pandas.tseries.holiday import get_calendar, HolidayCalendarFactory, GoodFriday

USFedCal = get_calendar('USFederalHolidayCalendar')

USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,3)) # <-- same start and end dates
DatetimeIndex([], dtype='datetime64[ns]', freq=None)

USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,6)) # <-- different start and end dates
DatetimeIndex(['2015-07-03'], dtype='datetime64[ns]', freq=None)

USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,3)) # <-- same start and end dates
DatetimeIndex(['2015-07-03'], dtype='datetime64[ns]', freq=None)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4