Adding default state/province holidays
Adding the holidays specific to Illinois is not so straightforward, because the add_country_holidays
method only takes an argument for country
, but not state or province. To add state- or province-level holidays, we need to use a new Prophet function, make_holidays_df
. Let's import it here:
from fbprophet.make_holidays import make_holidays_df
This function takes as input a list of years for which to populate the holidays as well as arguments for the country and state or province. Note that you must use all years in your training DataFrame as well as all years you intend to predict on. That is why, in the following code, we build a year list to contain all unique years in the training DataFrame. Then, because our make_future_dataframe
command will add one year to the forecast, we need to extend that year list to include one additional year:
year_list = df['ds'].dt.year.unique().tolist() # Identify the final year, as an integer...