pandas.tseries.offsets.CustomBusinessMonthBegin.holidays#
- CustomBusinessMonthBegin.holidays#
Return the holidays used for custom business day calculations.
This property returns a tuple or list of holidays used when calculating business days for custom business day offsets. For non-custom business offsets (e.g., standard BusinessDay, BusinessHour), this will be None.
- Returns:
- tuple, list, or None
Holidays used in business day calculations, or None if no custom holidays are specified.
See also
BusinessDay.holidaysHolidays for standard business day offset.
BusinessHour.holidaysHolidays for standard business hour offset.
CustomBusinessDay.holidaysHolidays for custom business day offset.
CustomBusinessHour.holidaysHolidays for custom business hour offset.
CustomBusinessMonthEnd.holidaysHolidays for custom business month end offset.
CustomBusinessMonthBegin.holidaysHolidays for custom business month begin offset.
CustomBusinessDay.weekmaskWeekmask for custom business day offset.
CustomBusinessDay.calendarCalendar for custom business day offset.
Examples
For standard business offsets, holidays is None:
>>> bd = pd.offsets.BusinessDay() >>> bd.holidays is None True
>>> bh = pd.offsets.BusinessHour() >>> bh.holidays is None True
For custom business day with explicit holidays:
>>> holidays = [pd.Timestamp("2023-12-25"), pd.Timestamp("2024-01-01")] >>> cbd = pd.offsets.CustomBusinessDay(holidays=holidays) >>> cbd.holidays (Timestamp('2023-12-25 00:00:00'), Timestamp('2024-01-01 00:00:00'))
For custom business hour with explicit holidays:
>>> cbh = pd.offsets.CustomBusinessHour(holidays=holidays) >>> cbh.holidays (Timestamp('2023-12-25 00:00:00'), Timestamp('2024-01-01 00:00:00'))
For custom business month end with explicit holidays:
>>> cbme = pd.offsets.CustomBusinessMonthEnd(holidays=holidays) >>> cbme.holidays (Timestamp('2023-12-25 00:00:00'), Timestamp('2024-01-01 00:00:00'))
For custom business month begin with explicit holidays:
>>> cbmb = pd.offsets.CustomBusinessMonthBegin(holidays=holidays) >>> cbmb.holidays (Timestamp('2023-12-25 00:00:00'), Timestamp('2024-01-01 00:00:00'))
For custom business offsets with a calendar:
>>> from pandas.tseries.holiday import USFederalHolidayCalendar >>> cal = USFederalHolidayCalendar() >>> cbd_cal = pd.offsets.CustomBusinessDay(calendar=cal) >>> isinstance(cbd_cal.holidays, tuple) True
>>> cbh_cal = pd.offsets.CustomBusinessHour(calendar=cal) >>> isinstance(cbh_cal.holidays, tuple) True