code: def roll_timeseries_dataframe(
      df,
      roll_feature_df,
      lookback,
      horizon,
      feature_col,
      target_col,
      id_col=None,
      label_len=0,
      contain_id=False,
      deploy_mode=False,
  ):
      """
      roll dataframe into numpy ndarray sequence samples.
  
      :param input_df: a dataframe which has been resampled in uniform frequency.
      :param roll_feature_df: an additional rolling feature dataframe that will
             be append to final result.
      :param lookback: the length of the past sequence
      :param horizon: int or list,
             if `horizon` is an int, we will sample `horizon` step
             continuously after the forecasting point.
             if `horizon` is an list, we will sample discretely according
             to the input list. 1 means the timestamp just after the observed data.
      :param feature_col: list, indicate the feature col name.
      :param target_col: list, indicate the target col name.
      :param id_col: str, indicate the id col name, only needed when contain_id is True.
      :param label_len: This parameter is only for transformer-based model.
      :param contain_id: This parameter is only for XShardsTSDataset
      :param deploy_mode: a bool indicates whether to use deploy mode, which will be used in
             production environment to reduce the latency of data processing. The value
             defaults to False.
      :return: x, y
          x: 3-d numpy array in format (no. of samples, lookback, feature_col length)
          y: 3-d numpy array in format (no. of samples, horizon, target_col length)
      Note: Specially, if `horizon` is set to 0, then y will be None.
      """
      if deploy_mode:
          return _roll_timeseries_dataframe_test(
              df,
              roll_feature_df,
              lookback,
              feature_col,
              target_col,
              id_col=id_col,
              contain_id=contain_id,
          )
  
      from bigdl.nano.utils.common import invalidInputError
  
      invalidInputError(
          isinstance(df, pd.DataFrame),
          "df is expected to be pandas dataframe",
      )
      invalidInputError(
          isinstance(lookback, int), "lookback is expected to be int"
      )
      invalidInputError(
          isinstance(feature_col, list),
          "feature_col is expected to be list",
      )
      invalidInputError(
          isinstance(target_col, list),
          "target_col is expected to be list",
      )
      is_horizon_int = isinstance(horizon, int)
      is_horizon_list = (
          isinstance(horizon, list)
          and isinstance(horizon[0], int)
          and min(horizon) > 0
      )
      invalidInputError(
          is_horizon_int or is_horizon_list,
          "horizon is expected to be a list or int",
      )
  
      # don't enter test mode if label_len!=0
      # TODO: change to use is_predict.
      is_test = (
          True
          if (is_horizon_int and horizon == 0 and label_len == 0)
          else False
      )
      if not is_test:
          return _roll_timeseries_dataframe_train(
              df,
              roll_feature_df,
              lookback,
              horizon,
              feature_col,
              target_col,
              id_col=id_col,
              label_len=label_len,
              contain_id=contain_id,
          )
      else:
          return _roll_timeseries_dataframe_test(
              df,
              roll_feature_df,
              lookback,
              feature_col,
              target_col,
              id_col=id_col,
              contain_id=contain_id,
          )
  
file_path: BigDL/python/chronos/src/bigdl/chronos/data/utils/roll.py
imports: import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: roll_timeseries_dataframe(df, roll_feature_df, lookback, horizon, feature_col, target_col, id_col, label_len, contain_id, deploy_mode) and returns: _roll_timeseries_dataframe_test, _roll_timeseries_dataframe_train, _roll_timeseries_dataframe_test