You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
fromdatetimeimportdatetimefrompandas.tseries.holidayimportget_calendar, HolidayCalendarFactory, GoodFridayUSFedCal=get_calendar('USFederalHolidayCalendar')
USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,3)) # <-- same start and end datesDatetimeIndex([], dtype='datetime64[ns]', freq=None)
USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,6)) # <-- different start and end datesDatetimeIndex(['2015-07-03'], dtype='datetime64[ns]', freq=None)
USFedCal.holidays(datetime(2015,7,3), datetime(2015,7,3)) # <-- same start and end datesDatetimeIndex(['2015-07-03'], dtype='datetime64[ns]', freq=None)
The text was updated successfully, but these errors were encountered:
This is a little ugly. Basically since the real holiday is on the 4th, the first call doesn't get the 4th to apply its observance rule to the 3rd (as it's not in the range). The second call spans the 4th so the observance rule can be applied and the third call uses the cache from the second call. I suppose a simple solution is to always move the end date out a few days so that observance rules can be applied and then filtered for the given date range.
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:
The text was updated successfully, but these errors were encountered: