The CustomBusinessHour is a mixture of BusinessHour and
CustomBusinessDay which allows you to specify arbitrary holidays. For
details, see Custom Business Hour (GH11514)
In [1]: from pandas.tseries.offsets import CustomBusinessHour
In [2]: from pandas.tseries.holiday import USFederalHolidayCalendar
In [3]: bhour_us = CustomBusinessHour(calendar=USFederalHolidayCalendar())
Friday before MLK Day
In [4]: dt = datetime(2014, 1, 17, 15)
In [5]: dt + bhour_us
Out[5]: Timestamp('2014-01-17 16:00:00')
Tuesday after MLK Day (Monday is skipped because it’s a holiday)
In [6]: dt + bhour_us * 2
Out[6]: Timestamp('2014-01-21 09:00:00')
从版本0.18.1开始,您可以使用^{} :
我使用的一个例子是
相关问题 更多 >
编程相关推荐