code: def split_timeseries_dataframe(
      df, id_col, val_ratio=0, test_ratio=0.1, look_back=0, horizon=1
  ):
      """
      split input dataframe into train_df, val_df and test_df according to split ratio.
      The dataframe is splitted in its originally order in timeline.
      e.g. |......... train_df(80%) ........ | ... val_df(10%) ...| ...test_df(10%)...|
      :param df: dataframe to be splitted
      :param id_col: id column name
      :param val_ratio: validation ratio
      :param test_ratio: test ratio
      :param look_back: the length to look back
      :param horizon: num of steps to look forward
  
      :return: splited dataframes
      """
      split_result = df.groupby(id_col).apply(
          lambda df: split_single_timeseries_dataframe(
              df=df,
              val_ratio=val_ratio,
              test_ratio=test_ratio,
              look_back=look_back,
              horizon=horizon,
          )
      )
      train_df = pd.concat(
          [split_result[i][0] for i in split_result.index]
      )
      valid_df = pd.concat(
          [split_result[i][1] for i in split_result.index]
      )
      test_df = pd.concat(
          [split_result[i][2] for i in split_result.index]
      )
      return train_df, valid_df, test_df
  
label_desc: Use image node_id 1 for calling a global function with example usage: split_timeseries_dataframe(df, id_col, val_ratio, test_ratio, look_back, horizon) and returns: train_df,  valid_df,  test_df