code: def _fit(self, ts: Union[pd.Series, pd.DataFrame]) -> None:
      if isinstance(ts, pd.Series):
          s = ts.copy()  # type: pd.Series
          self._fit_core(s)
          self._fitted = 1
      elif isinstance(ts, pd.DataFrame):
          df = ts.copy()
          if not isinstance(df.index, pd.DatetimeIndex):
              raise TypeError(
                  "Index of the input time series must be a pandas "
                  "DatetimeIndex object."
              )
          if df.columns.duplicated().any():
              raise ValueError(
                  "Input DataFrame must have unique column names."
              )
          # create internal models
          self._models = {
              col: self.__class__(**deepcopy(self.get_params()))
              for col in df.columns
          }
          # fit model for each column
          for col in df.columns:
              self._models[col].fit(df[col])
          self._fitted = 2
      else:
          raise TypeError("Input must be a pandas Series or DataFrame.")
  
imports: from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import Any, Dict, List, Tuple, Union
  import pandas
label_desc: Use image node_id 2 for calling the _TrainableUnivariateModel obj's underlying member method code with example usage: obj._fit(ts) without return types