class_docstr: Class for preprocessing Time Series Forecasting Experiments.
class_docstr_tok: ["Class","for","preprocessing","Time","Series","Forecasting","Experiments","."]
docstr: Perform numeric imputation of missing values.
  
  Parameters
  ----------
  numeric_imputation : Union[str, int, float]
      The method to be used for imputation.
      If str, then passed as is to the underlying `sktime` imputer.
      Allowed values are:
          "drift", "linear", "nearest", "mean", "median", "backfill",
          "bfill", "pad", "ffill", "random"
      If int or float, imputation method is set to "constant" with the given value.
  target : bool, optional
      If True, imputation is added to the target variable steps
      If False, imputation is added to the exogenous variable steps,
      by default True
  
  Raises
  ------
  ValueError
      (1) `numeric_imputation` is of type str but not of one of the allowed values.
      (2) `numeric_imputation` is not of one of the allowed types.
docstr_tok: ["Perform","numeric","imputation","of","missing","values",".","Parameters","--","--","--","--","--","numeric_imputation",":","Union","[","str",",","int",",","float","]","The","method","to","be","used","for","imputation",".","If","str",",","then","passed","as","is","to","the","underlying","`","sktime","`","imputer",".","Allowed","values","are",":","``","drift","''",",","``","linear","''",",","``","nearest","''",",","``","mean","''",",","``","median","''",",","``","backfill","''",",","``","bfill","''",",","``","pad","''",",","``","ffill","''",",","``","random","''","If","int","or","float",",","imputation","method","is","set","to","``","constant","''","with","the","given","value",".","target",":","bool",",","optional","If","True",",","imputation","is","added","to","the","target","variable","steps","If","False",",","imputation","is","added","to","the","exogenous","variable","steps",",","by","default","True","Raises","--","--","--","ValueError","(","1",")","`","numeric_imputation","`","is","of","type","str","but","not","of","one","of","the","allowed","values",".","(","2",")","`","numeric_imputation","`","is","not","of","one","of","the","allowed","types","."]
code: def _add_imputation_steps(
      self,
      numeric_imputation: Union[str, int, float],
      target: bool = True,
  ):
      """Perform numeric imputation of missing values.
  
      Parameters
      ----------
      numeric_imputation : Union[str, int, float]
          The method to be used for imputation.
          If str, then passed as is to the underlying `sktime` imputer.
          Allowed values are:
              "drift", "linear", "nearest", "mean", "median", "backfill",
              "bfill", "pad", "ffill", "random"
          If int or float, imputation method is set to "constant" with the given value.
      target : bool, optional
          If True, imputation is added to the target variable steps
          If False, imputation is added to the exogenous variable steps,
          by default True
  
      Raises
      ------
      ValueError
          (1) `numeric_imputation` is of type str but not of one of the allowed values.
          (2) `numeric_imputation` is not of one of the allowed types.
      """
      type_ = "Target" if target else "Exogenous"
      self.logger.info(f"Set up imputation for {type_} variable(s).")
  
      if isinstance(numeric_imputation, str):
          allowed_values = [
              "drift",
              "linear",
              "nearest",
              "mean",
              "median",
              "backfill",
              "bfill",
              "pad",
              "ffill",
              "random",
          ]
          if numeric_imputation not in allowed_values:
              raise ValueError(
                  f"{type_} Imputation Type '{numeric_imputation}' not allowed."
              )
          num_estimator = Imputer(
              method=numeric_imputation, random_state=self.seed
          )
      elif isinstance(numeric_imputation, (int, float)):
          num_estimator = Imputer(
              method="constant", value=numeric_imputation
          )
      else:
          raise ValueError(
              f"{type_} Imputation Type '{type(numeric_imputation)}' is not of allowed type."
          )
  
      if target:
          self.transformer_steps_target.extend(
              [("numerical_imputer", num_estimator)]
          )
      else:
          self.transformer_steps_exogenous.extend(
              [("numerical_imputer", num_estimator)]
          )
  
file_path: pycaret/pycaret/internal/preprocess/time_series/forecasting/preprocessor.py
imports: from typing import Optional, Union
  from sklearn.preprocessing import MaxAbsScaler, MinMaxScaler, RobustScaler, StandardScaler
  from sktime.transformations.compose import ColumnwiseTransformer
  from sktime.transformations.series.adapt import TabularToSeriesAdaptor
  from sktime.transformations.series.boxcox import BoxCoxTransformer, LogTransformer
  from sktime.transformations.series.cos import CosineTransformer
  from sktime.transformations.series.exponent import ExponentTransformer, SqrtTransformer
  from sktime.transformations.series.impute import Imputer
  from pycaret.utils.time_series import TSExogenousPresent
label_desc: Use image node_id 2 for calling the TSForecastingPreprocessor obj's underlying member method code with example usage: obj._add_imputation_steps(numeric_imputation, target) without return types