我正在使用pandas.tseries.holiday模块,并且在此模块中遇到了AbstractHolidayCalendar类的问题。用途是获取一个日历,该日历记录了前滚工作日的英国所有银行假日/周末。
我现有的代码(取自其他用户)是:
class EnglandAndWalesHolidayCalendar(AbstractHolidayCalendar):
rules = [Holiday('New Years Day', month=1, day=1, observance=next_monday),
GoodFriday,
EasterMonday,
Holiday('Early May bank holiday',
month=5, day=1, offset=DateOffset(weekday=MO(1))),
Holiday('Spring bank holiday',
month=5, day=31, offset=DateOffset(weekday=MO(-1))),
Holiday('Summer bank holiday',
month=8, day=31, offset=DateOffset(weekday=MO(-1))),
Holiday('Christmas Day', month=12, day=25, observance=next_monday),
Holiday('Boxing Day',
month=12, day=26, observance=next_monday_or_tuesday)]
在上面提到的pandas模块中,我看到以下内容:
class AbstractHolidayCalendar(object):
"""
Abstract interface to create holidays following certain rules.
"""
__metaclass__ = HolidayCalendarMetaClass
rules = []
start_date = Timestamp(datetime(1970, 1, 1))
end_date = Timestamp(datetime(2030, 12, 31))
_cache = None
但是在添加
时end_date = Timestamp(datetime(2080, 12, 31))
对于我定义的类,它似乎不起作用。有没有人知道如何调整结束日期而不直接更改pandas模块? 感谢