code: def _roll_timeseries_dataframe_train(
      df,
      roll_feature_df,
      lookback,
      horizon,
      feature_col,
      target_col,
      id_col,
      label_len,
      contain_id,
  ):
      from bigdl.nano.utils.common import invalidInputError
  
      if label_len != 0 and isinstance(horizon, list):
          invalidInputError(
              False,
              "horizon should be an integer if label_len is set to larger than 0.",
          )
      max_horizon = (
          horizon if isinstance(horizon, int) else max(horizon)
      )
      if max_horizon > 0:
          x = (
              df[:-max_horizon]
              .loc[:, target_col + feature_col]
              .values.astype(np.float32)
          )
      else:
          x = df.loc[:, target_col + feature_col].values.astype(
              np.float32
          )
      y = (
          df.iloc[lookback - label_len :]
          .loc[:, target_col]
          .values.astype(np.float32)
      )
  
      output_x, mask_x = _roll_timeseries_ndarray(x, lookback)
      if isinstance(horizon, list):
          output_y, mask_y = _roll_timeseries_ndarray(y, horizon)
      else:
          output_y, mask_y = _roll_timeseries_ndarray(
              y, horizon + label_len
          )
      mask = (mask_x == 1) & (mask_y == 1)
  
      x = _append_rolling_feature_df(output_x[mask], roll_feature_df)
  
      if contain_id:
          return x, output_y[mask], df.loc[:, [id_col]].values
      else:
          return x, output_y[mask]
  
file_path: BigDL/python/chronos/src/bigdl/chronos/data/utils/roll.py
imports: import numpy
  import pandas
label_desc: Use image node_id 4 for calling a global function with example usage: _roll_timeseries_dataframe_train(df, roll_feature_df, lookback, horizon, feature_col, target_col, id_col, label_len, contain_id) and returns: x,  output_y,  df, x,  output_y