docstr: Generic wrapper class for scalers/encoders/transformers of static covariates. This transformer acts
  only on static covariates of the series passed to ``fit()``, ``transform()``, ``fit_transform()``, and
  ``inverse_transform()``. It can both scale numerical features, as well as encode categorical features.
  
  The underlying ``transformer_num`` and ``transformer_cat`` have to implement the ``fit()``, ``transform()``,
  and ``inverse_transform()`` methods (typically from scikit-learn).
  
  By default, numerical and categorical columns/features are inferred and allocated to ``transformer_num`` and
  ``transformer_cat``, respectively. Alternatively, specify which columns to scale/transform with ``cols_num``
  and ``cols_cat``.
  
  Both ``transformer_num`` and ``transformer_cat`` are fit globally on static covariate data from all series
  passed to :class:`StaticCovariatesTransformer.fit()`
  
  Parameters
  ----------
  transformer_num
      The transformer to transform numeric static covariate columns with. It must provide ``fit()``,
      ``transform()`` and ``inverse_transform()`` methods.
      Default: :class:`sklearn.preprocessing.MinMaxScaler(feature_range=(0, 1))`; this will scale all
      values between 0 and 1.
  transformer_cat
      The encoder to transform categorical static covariate columns with. It must provide ``fit()``,
      ``transform()`` and ``inverse_transform()`` methods.
      Default: :class:`sklearn.preprocessing.OrdinalEncoder()`; this will convert categories
      into integer valued arrays where each integer stands for a specific category.
  cols_num
      Optionally, a list of column names for which to apply the numeric transformer ``transformer_num``.
      By default, the transformer will infer all numerical features based on types, and scale them with
      `transformer_num`. If an empty list, no column will be scaled.
  cols_cat
      Optionally, a list of column names for which to apply the categorical transformer `transformer_cat`.
      By default, the transformer will infer all categorical features based on types, and transform them with
      `transformer_cat`. If an empty list, no column will be transformed.
  name
      A specific name for the :class:`StaticCovariatesTransformer`.
  n_jobs
      The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
      passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
      (sequential). Setting the parameter to `-1` means using all the available processors.
      Note: for a small amount of data, the parallelisation overhead could end up increasing the total
      required amount of time.
  verbose
      Optionally, whether to print operations progress
  
  Examples
  --------
  >>> import numpy as np
  >>> import pandas as pd
  >>> from darts import TimeSeries
  >>> from darts.dataprocessing.transformers import StaticCovariatesTransformer
  >>> static_covs = pd.DataFrame(data={"num": [0, 2, 1], "cat": ["a", "c", "b"]})
  >>> series = TimeSeries.from_values(
  >>>     values=np.random.random((10, 3)),
  >>>     columns=["comp1", "comp2", "comp3"],
  >>>     static_covariates=static_covs,
  >>> )
  >>> transformer = StaticCovariatesTransformer()
  >>> series_transformed = transformer.fit_transform(series)
  >>> print(series.static_covariates)
  static_covariates  num cat
  component
  comp1               0.0   a
  comp2               2.0   c
  comp3               1.0   b
  >>> print(series_transformed.static_covariates)
  static_covariates  num  cat
  component
  comp1               0.0  0.0
  comp2               1.0  2.0
  comp3               0.5  1.0
docstr_tok: ["Generic","wrapper","class","for","scalers\/encoders\/transformers","of","static","covariates",".","This","transformer","acts","only","on","static","covariates","of","the","series","passed","to","``","fit","(",")","``",",","``","transform","(",")","``",",","``","fit_transform","(",")","``",",","and","``","inverse_transform","(",")","``",".","It","can","both","scale","numerical","features",",","as","well","as","encode","categorical","features",".","The","underlying","``","transformer_num","``","and","``","transformer_cat","``","have","to","implement","the","``","fit","(",")","``",",","``","transform","(",")","``",",","and","``","inverse_transform","(",")","``","methods","(","typically","from","scikit-learn",")",".","By","default",",","numerical","and","categorical","columns\/features","are","inferred","and","allocated","to","``","transformer_num","``","and","``","transformer_cat","``",",","respectively",".","Alternatively",",","specify","which","columns","to","scale\/transform","with","``","cols_num","``","and","``","cols_cat","``",".","Both","``","transformer_num","``","and","``","transformer_cat","``","are","fit","globally","on","static","covariate","data","from","all","series","passed","to",":","class",":","`","StaticCovariatesTransformer.fit","(",")","`","Parameters","--","--","--","--","--","transformer_num","The","transformer","to","transform","numeric","static","covariate","columns","with",".","It","must","provide","``","fit","(",")","``",",","``","transform","(",")","``","and","``","inverse_transform","(",")","``","methods",".","Default",":",":","class",":","`","sklearn.preprocessing.MinMaxScaler","(","feature_range=","(","0",",","1",")",")","`",";","this","will","scale","all","values","between","0","and","1.","transformer_cat","The","encoder","to","transform","categorical","static","covariate","columns","with",".","It","must","provide","``","fit","(",")","``",",","``","transform","(",")","``","and","``","inverse_transform","(",")","``","methods",".","Default",":",":","class",":","`","sklearn.preprocessing.OrdinalEncoder","(",")","`",";","this","will","convert","categories","into","integer","valued","arrays","where","each","integer","stands","for","a","specific","category",".","cols_num","Optionally",",","a","list","of","column","names","for","which","to","apply","the","numeric","transformer","``","transformer_num","``",".","By","default",",","the","transformer","will","infer","all","numerical","features","based","on","types",",","and","scale","them","with","`","transformer_num","`",".","If","an","empty","list",",","no","column","will","be","scaled",".","cols_cat","Optionally",",","a","list","of","column","names","for","which","to","apply","the","categorical","transformer","`","transformer_cat","`",".","By","default",",","the","transformer","will","infer","all","categorical","features","based","on","types",",","and","transform","them","with","`","transformer_cat","`",".","If","an","empty","list",",","no","column","will","be","transformed",".","name","A","specific","name","for","the",":","class",":","`","StaticCovariatesTransformer","`",".","n_jobs","The","number","of","jobs","to","run","in","parallel",".","Parallel","jobs","are","created","only","when","a","``","Sequence","[","TimeSeries","]","``","is","passed","as","input","to","a","method",",","parallelising","operations","regarding","different","``","TimeSeries","``",".","Defaults","to","`","1","`","(","sequential",")",".","Setting","the","parameter","to","`","-1","`","means","using","all","the","available","processors",".","Note",":","for","a","small","amount","of","data",",","the","parallelisation","overhead","could","end","up","increasing","the","total","required","amount","of","time",".","verbose","Optionally",",","whether","to","print","operations","progress","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","import","pandas","as","pd",">",">",">","from","darts","import","TimeSeries",">",">",">","from","darts.dataprocessing.transformers","import","StaticCovariatesTransformer",">",">",">","static_covs","=","pd.DataFrame","(","data=","{","``","num","''",":","[","0",",","2",",","1","]",",","``","cat","''",":","[","``","a","''",",","``","c","''",",","``","b","''","]","}",")",">",">",">","series","=","TimeSeries.from_values","(",">",">",">","values=np.random.random","(","(","10",",","3",")",")",",",">",">",">","columns=","[","``","comp1","''",",","``","comp2","''",",","``","comp3","''","]",",",">",">",">","static_covariates=static_covs",",",">",">",">",")",">",">",">","transformer","=","StaticCovariatesTransformer","(",")",">",">",">","series_transformed","=","transformer.fit_transform","(","series",")",">",">",">","print","(","series.static_covariates",")","static_covariates","num","cat","component","comp1","0.0","a","comp2","2.0","c","comp3","1.0","b",">",">",">","print","(","series_transformed.static_covariates",")","static_covariates","num","cat","component","comp1","0.0","0.0","comp2","1.0","2.0","comp3","0.5","1.0"]
code: def __init__(
      self,
      transformer_num=None,
      transformer_cat=None,
      cols_num: Optional[List[str]] = None,
      cols_cat: Optional[List[str]] = None,
      name="StaticCovariatesTransformer",
      n_jobs: int = 1,
      verbose: bool = False,
  ):
      """Generic wrapper class for scalers/encoders/transformers of static covariates. This transformer acts
      only on static covariates of the series passed to ``fit()``, ``transform()``, ``fit_transform()``, and
      ``inverse_transform()``. It can both scale numerical features, as well as encode categorical features.
  
      The underlying ``transformer_num`` and ``transformer_cat`` have to implement the ``fit()``, ``transform()``,
      and ``inverse_transform()`` methods (typically from scikit-learn).
  
      By default, numerical and categorical columns/features are inferred and allocated to ``transformer_num`` and
      ``transformer_cat``, respectively. Alternatively, specify which columns to scale/transform with ``cols_num``
      and ``cols_cat``.
  
      Both ``transformer_num`` and ``transformer_cat`` are fit globally on static covariate data from all series
      passed to :class:`StaticCovariatesTransformer.fit()`
  
      Parameters
      ----------
      transformer_num
          The transformer to transform numeric static covariate columns with. It must provide ``fit()``,
          ``transform()`` and ``inverse_transform()`` methods.
          Default: :class:`sklearn.preprocessing.MinMaxScaler(feature_range=(0, 1))`; this will scale all
          values between 0 and 1.
      transformer_cat
          The encoder to transform categorical static covariate columns with. It must provide ``fit()``,
          ``transform()`` and ``inverse_transform()`` methods.
          Default: :class:`sklearn.preprocessing.OrdinalEncoder()`; this will convert categories
          into integer valued arrays where each integer stands for a specific category.
      cols_num
          Optionally, a list of column names for which to apply the numeric transformer ``transformer_num``.
          By default, the transformer will infer all numerical features based on types, and scale them with
          `transformer_num`. If an empty list, no column will be scaled.
      cols_cat
          Optionally, a list of column names for which to apply the categorical transformer `transformer_cat`.
          By default, the transformer will infer all categorical features based on types, and transform them with
          `transformer_cat`. If an empty list, no column will be transformed.
      name
          A specific name for the :class:`StaticCovariatesTransformer`.
      n_jobs
          The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
          passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
          (sequential). Setting the parameter to `-1` means using all the available processors.
          Note: for a small amount of data, the parallelisation overhead could end up increasing the total
          required amount of time.
      verbose
          Optionally, whether to print operations progress
  
      Examples
      --------
      >>> import numpy as np
      >>> import pandas as pd
      >>> from darts import TimeSeries
      >>> from darts.dataprocessing.transformers import StaticCovariatesTransformer
      >>> static_covs = pd.DataFrame(data={"num": [0, 2, 1], "cat": ["a", "c", "b"]})
      >>> series = TimeSeries.from_values(
      >>>     values=np.random.random((10, 3)),
      >>>     columns=["comp1", "comp2", "comp3"],
      >>>     static_covariates=static_covs,
      >>> )
      >>> transformer = StaticCovariatesTransformer()
      >>> series_transformed = transformer.fit_transform(series)
      >>> print(series.static_covariates)
      static_covariates  num cat
      component
      comp1               0.0   a
      comp2               2.0   c
      comp3               1.0   b
      >>> print(series_transformed.static_covariates)
      static_covariates  num  cat
      component
      comp1               0.0  0.0
      comp2               1.0  2.0
      comp3               0.5  1.0
      """
      # Define fixed params (i.e. attributes defined before calling `super().__init__`):
      self.transformer_num = (
          MinMaxScaler() if transformer_num is None else transformer_num
      )
      self.transformer_cat = (
          OrdinalEncoder()
          if transformer_cat is None
          else transformer_cat
      )
  
      for transformer, transformer_name in zip(
          [self.transformer_num, self.transformer_cat],
          ["transformer_num", "transformer_cat"],
      ):
          if (
              not callable(getattr(transformer, "fit", None))
              or not callable(getattr(transformer, "transform", None))
              or not callable(
                  getattr(transformer, "inverse_transform", None)
              )
          ):
              raise_log(
                  ValueError(
                      f"The provided `{transformer_name}` object must have fit(), transform() and "
                      f"inverse_transform() methods"
                  ),
                  logger,
              )
  
      # numeric/categorical cols will be inferred at fitting time, if user did not set them
      self.cols_num, self.cols_cat = cols_num, cols_cat
  
      super().__init__(
          name=name,
          n_jobs=n_jobs,
          verbose=verbose,
          mask_components=False,
          global_fit=True,
      )
  
imports: from collections import OrderedDict
  from typing import Any, Dict, List, Optional, Sequence, Tuple
  import numpy
  import pandas
  from scipy.sparse import csr_matrix
  from sklearn.preprocessing import MinMaxScaler, OrdinalEncoder
  from darts.logging import get_logger, raise_log
  from darts.timeseries import TimeSeries
  from .fittable_data_transformer import FittableDataTransformer
  from .invertible_data_transformer import InvertibleDataTransformer
label_desc: Use image node_id 1 to create a new StaticCovariatesTransformer object from inherited base classes: FittableDataTransformer, InvertibleDataTransformer with example: obj = StaticCovariatesTransformer(transformer_num, transformer_cat, cols_num, cols_cat, name, n_jobs, verbose)