pandas.tseries.holiday.register#
- pandas.tseries.holiday.register(cls)[source]#
Add a holiday calendar class to the registry of named calendars.
Calendar classes register themselves as soon as they are defined, so this is rarely called directly. A class is registered under its
nameattribute if it has one and under its class name otherwise, and registering a class under a name that is already taken replaces the earlier one.See also
tseries.holiday.get_calendarReturn an instance of a calendar based on its name.
tseries.holiday.HolidayCalendarFactoryCreate a holiday calendar class from two sets of rules.
tseries.holiday.AbstractHolidayCalendarAbstract interface to create holidays following certain rules.
Examples
>>> from pandas.tseries.holiday import ( ... AbstractHolidayCalendar, ... USLaborDay, ... get_calendar, ... register, ... ) >>> class MyCalendar(AbstractHolidayCalendar): ... rules = [USLaborDay] >>> MyCalendar.name = "us_labor_only" >>> register(MyCalendar) >>> [rule.name for rule in get_calendar("us_labor_only").rules] ['Labor Day']