pandas.tseries.holiday.AbstractHolidayCalendar.rule_from_name#

AbstractHolidayCalendar.rule_from_name(name)[source]#

Return the rule for the holiday with the given name.

Searches self.rules for a Holiday whose name attribute matches exactly.

Parameters:
namestr

Name of the holiday whose rule should be returned.

Returns:
Holiday or None

The matching rule from self.rules, or None if no rule with the given name is found.

See also

tseries.holiday.AbstractHolidayCalendar.holidays

Return a curve with holidays between start_date and end_date.

Examples

>>> from pandas.tseries.holiday import AbstractHolidayCalendar, USLaborDay
>>> class MyCalendar(AbstractHolidayCalendar):
...     rules = [USLaborDay]
>>> MyCalendar().rule_from_name("Labor Day")
Holiday: Labor Day (month=9, day=1, offset=<DateOffset: weekday=MO(+1)>)