Skip to main content
`Ctrl`+`K`

# pandas.tseries.holiday.AbstractHolidayCalendar

class pandas.tseries.holiday.AbstractHolidayCalendar(name='', rules=None)

  Abstract interface to create holidays following certain rules.

  A subclass normally defines its holidays by setting `rules` to a list of `Holiday` instances directly on the class body. Alternatively, a set of rules can be passed to the constructor. The calendar can then be used to compute the holiday dates falling within a given date range via `holidays()`.

  Parameters:
    name str

      Name of the holiday calendar, defaults to class name.

    rules array of Holiday objects

      A set of rules used to create the holidays.

  See also

  `tseries.holiday.Holiday`

    Class that defines a holiday with start/end dates and rules for observance.

  `tseries.offsets.CustomBusinessDay`

    DateOffset subclass representing possibly n business days excluding holidays.

  Examples

      >>> from pandas.tseries.holiday import AbstractHolidayCalendar, USLaborDay
      >>> class MyCalendar(AbstractHolidayCalendar):
      ...     rules = [USLaborDay]
      >>> MyCalendar().holidays(start="2020-01-01", end="2020-12-31")
      DatetimeIndex(['2020-09-07'], dtype='datetime64[us]', freq=None)

  Attributes

  `end_date` |
  `rules` |
  `start_date` |

  Methods

  `holidays`([start, end, return_name]) | Return a curve with holidays between start_date and end_date.
  `merge`(other[, inplace]) | Merge holiday calendars together.
  `merge_class`(base, other) | Merge holiday calendars together.
  `rule_from_name`(name) | Return the rule for the holiday with the given name.