code: def _prepare_test_data(self, dataset):
      logging.info("group test time-series to datasets")
  
      def left_pad_data(data: DataEntry):
          ts = self.to_ts(data)
          filled_ts = ts.reindex(
              pd.date_range(
                  start=self.first_timestamp,
                  end=ts.index[-1],
                  freq=data["start"].freq,
              ),
              fill_value=0.0,
          )
          return filled_ts.values
  
      grouped_entry = [left_pad_data(data) for data in dataset]
      grouped_entry = np.array(grouped_entry)
  
      split_dataset = np.split(grouped_entry, self.num_test_dates)
  
      all_entries = list()
      for dataset_at_test_date in split_dataset:
          grouped_data = dict()
          assert (
              len(set([len(x) for x in dataset_at_test_date])) == 1
          ), "all test time-series should have the same length"
          grouped_data["target"] = np.array(
              list(dataset_at_test_date), dtype=np.float32
          )
          if self.max_target_dimension is not None:
              grouped_data["target"] = grouped_data["target"][
                  -self.max_target_dimension :, :
              ]
          grouped_data["item_id"] = "all_items"
          grouped_data["start"] = self.first_timestamp
          grouped_data["feat_static_cat"] = [0]
          all_entries.append(grouped_data)
  
      return ListDataset(
          all_entries, freq=self.frequency, one_dim_target=False
      )
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/multivariate/datasets/grouper.py
imports: import logging
  import numpy
  import pandas
  from gluonts.dataset.common import ListDataset, DataEntry, Dataset
label_desc: Use image node_id 8 for calling the Grouper obj's underlying member method code with example usage: obj._prepare_test_data(dataset) and returns: ListDataset, filled_ts