!pip install -Uqq nixtla
from nixtla.utils import in_colab
IN_COLAB = in_colab()
if not IN_COLAB:
    from nixtla.utils import colab_badge
    from dotenv import load_dotenv
You can create DataFrames specifying holidays for particular countries and specify your own special dates to include them as features for forecasting.
import pandas as pd
from nixtla import NixtlaClient
from nixtla.date_features import CountryHolidays
from nixtla.date_features import SpecialDates
nixtla_client = NixtlaClient(
    # defaults to os.environ.get("NIXTLA_API_KEY")
    api_key = 'my_api_key_provided_by_nixtla'
)
👍 Use an Azure AI endpoint To use an Azure AI endpoint, remember to set also the base_url argument: nixtla_client = NixtlaClient(base_url="you azure ai endpoint", api_key="your api_key")
if not IN_COLAB:
    nixtla_client = NixtlaClient()
# Get country holidays for the US
c_holidays = CountryHolidays(countries=['US'])
periods = 365 * 1
dates = pd.date_range(end='2023-09-01', periods=periods)
holidays_df = c_holidays(dates)

# Specify your own 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 * 1
dates = pd.date_range(end='2023-09-01', periods=periods)
special_dates_df = special_dates(dates)
For a detailed guide on using special dates and holidays, read our tutorial on Holidays and special dates.