code: def split_events_into_dictionaries(
      events_df,
      events,
      date_col=EVENT_DF_DATE_COL,
      name_col=EVENT_DF_LABEL_COL,
      default_category="Other",
  ):
      """Splits pd.Dataframe(date, holiday) into separate dataframes, one per event
  
      Can be used to create the `daily_event_df_dict` parameter for `forecast_silverkite`.
      Each event specified in `events` gets its own effect in the model.
          Other events are grouped together and modeled with the same effect
  
      :param events_df: pd.DataFrame with date_col and name_col columns
          contains events
      :param events: list(str)
          names of events in events_df.name_col.unique() to split into separate
          dataframes
      :param date_col: str, default "date"
          column in event_df containing the date
      :param name_col: str, default EVENT_DF_LABEL_COL
          column in event_df containing the event name
      :param default_category: str
          name of default event
  
      :return: dict(label: pd.Dataframe(date_col, name_col))
          with keys = events + [default_category]
              name_col column has a constant value = EVENT_INDICATOR
      """
      result = {}
      # separates rows corresponding to each event into their own dataframe
      for event_name in events:
          event_df = events_df[events_df[name_col] == event_name].copy()
          if event_df.shape[0] > 0:
              event_df[
                  name_col
              ] = EVENT_INDICATOR  # All dates in this df are for the event
              event_key = event_name.replace(
                  "'", ""
              )  # ensures patsy module can parse column name in formula
              result[
                  event_key
              ] = event_df.drop_duplicates().reset_index(drop=True)
          else:
              warnings.warn(
                  f"Requested holiday '{event_name}' does not occur in the provided countries"
              )
  
      # groups other events into the same bucket
      other_df = events_df[~events_df[name_col].isin(events)].copy()
      if other_df.shape[0] > 0:
          other_df[name_col] = EVENT_INDICATOR
          default_category = default_category.replace("'", "")
          result[
              default_category
          ] = other_df.drop_duplicates().reset_index(drop=True)
  
      # there must be no duplicated dates in each DataFrame
      for k, df in result.items():
          assert not any(df[date_col].duplicated())
  
      return result
  
file_path: greykite/greykite/algo/forecast/silverkite/forecast_simple_silverkite_helper.py
imports: import warnings
  import pandas
  from greykite.common import constants
  from greykite.common.constants import EVENT_DF_DATE_COL
  from greykite.common.constants import EVENT_DF_LABEL_COL
  from greykite.common.constants import EVENT_INDICATOR
  from greykite.common.features.timeseries_features import add_event_window_multi
  from greykite.common.features.timeseries_features import get_fourier_col_name
  from greykite.common.features.timeseries_features import get_holidays
  from greykite.common.python_utils import split_offset_str
label_desc: Use image node_id 3 for calling a global function with example usage: split_events_into_dictionaries(events_df, events, date_col, name_col, default_category) and returns: result