pandas.tseries.holiday.Holiday.dates#
- Holiday.dates(start_date, end_date, return_name=False)[source]#
Calculate holidays observed between start date and end date.
Dates are computed from the rules defined for this holiday, i.e. its fixed
year/month/day, or itsoffset/observanceapplied to each occurrence ofmonth/daybetween the year beforestart_dateand the year afterend_date.- Parameters:
- start_datestarting date, datetime-like, optional
The earliest date to consider in the search.
- end_dateending date, datetime-like, optional
The latest date to consider in the search.
- return_namebool, optional, default=False
If True, return a series that has dates and holiday names. False will only return dates.
- Returns:
- Series or DatetimeIndex
Series if return_name is True, otherwise a DatetimeIndex of the holiday’s dates.
See also
tseries.holiday.AbstractHolidayCalendar.holidaysReturn a curve with holidays between start_date and end_date.
Examples
>>> from dateutil.relativedelta import MO >>> USMemorialDay = pd.tseries.holiday.Holiday( ... "Memorial Day", month=5, day=31, offset=pd.DateOffset(weekday=MO(-1)) ... ) >>> USMemorialDay.dates("2020-01-01", "2021-12-31") DatetimeIndex(['2020-05-25', '2021-05-31'], dtype='datetime64[us]', freq=None)