Time Series / Date functionality Holiday lookup - possible bug · Issue #11477 · pandas-dev/pandas (original) (raw)

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)