class_docstr: Transformer base class.
class_docstr_tok: ["Transformer","base","class","."]
docstr: Vectorized/iterated loop over method of BaseTransformer.
  
  Uses transformers_ attribute to store one transformer per loop index.
code: def _vectorize(self, methodname, **kwargs):
      """Vectorized/iterated loop over method of BaseTransformer.
  
      Uses transformers_ attribute to store one transformer per loop index.
      """
      X = kwargs.get("X")
      y = kwargs.pop("y", None)
      kwargs["args_rowvec"] = {"y": y}
      kwargs["rowname_default"] = "transformers"
      kwargs["colname_default"] = "transformers"
  
      FIT_METHODS = ["fit", "update"]
      TRAFO_METHODS = ["transform", "inverse_transform"]
  
      # fit-like methods: run method; clone first if fit
      if methodname in FIT_METHODS:
          if methodname == "fit":
              transformers_ = X.vectorize_est(
                  self,
                  method="clone",
                  rowname_default="transformers",
                  colname_default="transformers",
                  # no backend parallelization necessary for clone
              )
          else:
              transformers_ = self.transformers_
  
          self.transformers_ = X.vectorize_est(
              transformers_,
              method=methodname,
              backend=self.get_config()["backend:parallel"],
              backend_params=self.get_config()[
                  "backend:parallel:params"
              ],
              **kwargs,
          )
          return self
  
      if methodname in TRAFO_METHODS:
          # loop through fitted transformers one-by-one, and transform series/panels
          if not self.get_tag("fit_is_empty"):
              # if not fit_is_empty: check index compatibility, get fitted trafos
              n_trafos = len(X)
              n, m = self.transformers_.shape
              n_fit = n * m
              if n_trafos != n_fit:
                  raise RuntimeError(
                      f"{type(self).__name__} is a transformer that applies per "
                      "individual time series, and broadcasts across instances. "
                      f"In fit, {type(self).__name__} makes one fit per instance, "
                      "and applies that fit to the instance with the same index in "
                      "transform. Vanilla use therefore requires the same number "
                      "of instances in fit and transform, but"
                      "found different number of instances in transform than in fit. "
                      f"number of instances seen in fit: {n_fit}; "
                      f"number of instances seen in transform: {n_trafos}. "
                      "For fit/transforming per instance, e.g., for pre-processinng "
                      "in a time series classification, regression or clustering "
                      "pipeline, wrap this transformer in "
                      "FitInTransform, from sktime.transformations.compose."
                  )
  
              transformers_ = self.transformers_
  
          else:
              # if fit_is_empty: don't store transformers, run fit/transform in one
              transformers_ = X.vectorize_est(
                  self,
                  method="clone",
                  rowname_default="transformers",
                  colname_default="transformers",
                  # no backend parallelization necessary for clone
              )
              transformers_ = X.vectorize_est(
                  transformers_,
                  method="fit",
                  backend=self.get_config()["backend:parallel"],
                  backend_params=self.get_config()[
                      "backend:parallel:params"
                  ],
                  **kwargs,
              )
  
          # transform the i-th series/panel with the i-th stored transformer
          Xts = X.vectorize_est(
              transformers_,
              method=methodname,
              return_type="list",
              backend=self.get_config()["backend:parallel"],
              backend_params=self.get_config()[
                  "backend:parallel:params"
              ],
              **kwargs,
          )
          Xt = X.reconstruct(Xts, overwrite_index=False)
  
          return Xt
  
imports: from itertools import product
  from typing import Union
  import numpy
  import pandas
  from sktime.base import BaseEstimator
  from sktime.datatypes import VectorizedDF, check_is_error_msg, check_is_mtype, check_is_scitype, convert, convert_to, mtype_to_scitype, update_data
  from sktime.datatypes._series_as_panel import convert_to_scitype
  from sktime.utils.sklearn import is_sklearn_classifier, is_sklearn_clusterer, is_sklearn_regressor, is_sklearn_transformer
  from sktime.utils.validation._dependencies import _check_estimator_deps
label_desc: Use image node_id 19 for calling the BaseTransformer obj's underlying member method code with example usage: obj._vectorize(methodname) and returns: self, Xt