CountryHolidays

 CountryHolidays (countries:List[str])

Given a list of countries, returns a dataframe with holidays for each country.

import pandas as pd

c_holidays = CountryHolidays(countries=['US', 'MX'])
periods = 365 * 5
dates = pd.date_range(end='2023-09-01', periods=periods)
holidays_df = c_holidays(dates)
holidays_df.head()
US_New Year’s DayUS_Memorial DayUS_Independence DayUS_Labor DayUS_Veterans DayUS_Veterans Day (observed)US_ThanksgivingUS_Christmas DayUS_Martin Luther King Jr. DayUS_Washington’s BirthdayUS_Columbus DayUS_Independence Day (observed)US_New Year’s Day (observed)US_Juneteenth National Independence DayUS_Juneteenth National Independence Day (observed)US_Christmas Day (observed)MX_New Year’s DayMX_Constitution DayMX_Benito Juárez’s birthdayMX_Labor DayMX_Independence DayMX_Revolution DayMX_Change of Federal GovernmentMX_Christmas Day
2018-09-03000100000000000000000000
2018-09-04000000000000000000000000
2018-09-05000000000000000000000000
2018-09-06000000000000000000000000
2018-09-07000000000000000000000000

SpecialDates

 SpecialDates (special_dates:Dict[str,List[str]])

Given a dictionary of categories and dates, returns a dataframe with the special dates.

special_dates = SpecialDates(
    special_dates={
        'Important Dates': ['2021-02-26', '2020-02-26'],
        'Very Important Dates': ['2021-01-26', '2020-01-26', '2019-01-26']
    }
)
periods = 365 * 5
dates = pd.date_range(end='2023-09-01', periods=periods)
holidays_df = special_dates(dates)
holidays_df.head()
Important DatesVery Important Dates
2018-09-0300
2018-09-0400
2018-09-0500
2018-09-0600
2018-09-0700