code: def __init__(
      self,
      target: ndarray,
      start_time: Optional[pd.Timestamp] = None,
      time_unit: Optional[str] = None,
      time_index: Optional[pd.DatetimeIndex] = None,
      series_name: Optional[str] = None,
      target_names: Optional[Union[str, List[str]]] = None,
  ):
      if target.ndim == 1:
          self.target = target.reshape(-1, 1)
      else:
          self.target = target
      if time_index is None:
          assert not (
              (start_time is None) or (time_unit is None)
          ), "if `time_index` is not given, both `start_time` and `time_unit` must be specified"
          self.time_index = pd.date_range(
              start=start_time, periods=len(self), freq=time_unit
          )
          self.time_unit = time_unit
      else:
          assert len(time_index) == len(self.target)
          self.time_index = time_index
          self.time_unit = time_unit or pd.infer_freq(time_index)
      self.series_name = series_name or "Unknown"
      if target_names is None:
          self.target_names = [f"d_{i+1}" for i in range(self.d_data)]
      elif isinstance(target_names, str):
          if self.d_data > 1:
              self.target_names = [
                  f"{target_names}_{i+1}" for i in range(self.d_data)
              ]
          else:
              self.target_names = [target_names]
      else:
          err_msg = (
              f"expected {self.d_data}, given {len(target_names)}."
          )
          if len(target_names) > self.d_data:
              raise ValueError(
                  f"Too many target names are given, {err_msg}"
              )
          if len(target_names) < self.d_data:
              raise ValueError(
                  f"Not enough target names are given, {err_msg}"
              )
          self.target_names = target_names
  
      self._features = dict()
      self._static_features = set()
      self._revealed_features = set()
      self._observed_features = set()
      self._categorical_features = set()
      self._numerical_features = set()
  
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Union, Sequence, Optional, Callable, overload
  from operator import eq
  from collections import defaultdict
  import warnings
  from sklearn.preprocessing import LabelEncoder, StandardScaler
  from numpy import ndarray
  from tqdm import tqdm
  import numpy
  import pandas
  import torch
label_desc: Use image node_id 1 to create a new TimeSeries object from inherited base classes: Sequence with example: obj = TimeSeries(target, start_time, time_unit, time_index, series_name, target_names)