code: def create_data(loader=False, extra_feature=False):
      df = get_ts_df()
      if extra_feature:
          target = ["value"]
          extra = ["extra feature"]
      else:
          target = ["value", "extra feature"]
          extra = []
      tsdata_train, tsdata_val, tsdata_test = TSDataset.from_pandas(
          df,
          dt_col="datetime",
          target_col=target,
          extra_feature_col=extra,
          with_split=True,
          test_ratio=0.1,
          val_ratio=0.1,
      )
      if loader is True:
          train_loader = tsdata_train.to_torch_data_loader(
              lookback=24,
              horizon=5,
              roll=True,
              time_enc=True,
              label_len=12,
          )
          val_loader = tsdata_val.to_torch_data_loader(
              lookback=24,
              horizon=5,
              roll=True,
              time_enc=True,
              label_len=12,
              shuffle=False,
          )
          test_loader = tsdata_test.to_torch_data_loader(
              lookback=24,
              horizon=5,
              roll=True,
              time_enc=True,
              label_len=12,
              shuffle=False,
              is_predict=True,
          )
          return train_loader, val_loader, test_loader
      else:
          train_data = tsdata_train.roll(
              lookback=24, horizon=5, time_enc=True, label_len=12
          ).to_numpy()
          val_data = tsdata_val.roll(
              lookback=24, horizon=5, time_enc=True, label_len=12
          ).to_numpy()
          test_data = tsdata_test.roll(
              lookback=24,
              horizon=5,
              time_enc=True,
              label_len=12,
              is_predict=True,
          ).to_numpy()
          train_data = tuple(
              map(lambda x: x.astype(np.float32), train_data)
          )
          val_data = tuple(
              map(lambda x: x.astype(np.float32), val_data)
          )
          test_data = tuple(
              map(lambda x: x.astype(np.float32), test_data)
          )
          return train_data, val_data, test_data
  
imports: import numpy
  import pandas
  import tempfile
  import os
  from bigdl.chronos.utils import LazyImport
  from bigdl.chronos.data import TSDataset
  from unittest import TestCase
  import pytest
  from ..None import op_torch, op_automl
label_desc: Use image node_id 2 for calling a global function with example usage: create_data(loader, extra_feature) and returns: train_loader,  val_loader,  test_loader, train_data,  val_data,  test_data