docstr: A customized TorchDataset for rolling dataframe for time series applications.
  
  :param df: The dataframe to roll on. The dataframe could contain single id value or
      multiple id values. If the dataframe contains multiple ids, the rows of same id
      should be consecutive. And dataframe should have been ordered by timestamp for each id.
  :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: (optional) a str indicates the col name of dataframe id
  
  :return:
code: def __init__(
      self, df, lookback, horizon, feature_col, target_col, id_col=None
  ):
      """
      A customized TorchDataset for rolling dataframe for time series applications.
  
      :param df: The dataframe to roll on. The dataframe could contain single id value or
          multiple id values. If the dataframe contains multiple ids, the rows of same id
          should be consecutive. And dataframe should have been ordered by timestamp for each id.
      :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: (optional) a str indicates the col name of dataframe id
  
      :return:
  
      """
      df.reset_index(drop=True, inplace=True)
      feature_col = _to_list(feature_col, "feature_col")
      target_col = _to_list(target_col, "target_col")
      _check_cols_no_na(df, col_names=target_col + feature_col)
      cols = target_col + feature_col
      cols = cols[0] if len(cols) == 1 else cols
      self.arr = df.loc[:, cols].to_numpy()
      self.arr = (
          np.expand_dims(self.arr, axis=1)
          if self.arr.ndim == 1
          else self.arr
      )
      max_horizon = (
          horizon if isinstance(horizon, int) else max(horizon)
      )
      window_size = lookback + max_horizon
      self.roll_start_idxes = get_roll_start_idx(
          df, id_col, window_size=window_size
      )
      self.lookback = lookback
      self.horizon = horizon
      self.target_num = len(target_col)
  
file_path: analytics-zoo/pyzoo/zoo/chronos/data/utils/roll_dataset.py
imports: import numpy
  from torch.utils.data import Dataset
  import torch
  from zoo.chronos.data.utils.utils import _check_cols_no_na, _to_list
label_desc: Use image node_id 1 to create a new RollDataset object from inherited base classes: Dataset with example: obj = RollDataset(df, lookback, horizon, feature_col, target_col, id_col)