docstr: If static covariates are component-specific, they must be reshaped appropriately.
docstr_tok: ["If","static","covariates","are","component-specific",",","they","must","be","reshaped","appropriately","."]
code: def _process_static_covariates(
      series: TimeSeries,
      n_midas: int,
      drop_static_covariates: bool,
      inverse_transform: bool,
  ) -> Optional[Union[pd.Series, pd.DataFrame]]:
      """
      If static covariates are component-specific, they must be reshaped appropriately.
      """
      static_covariates = series.static_covariates
      if drop_static_covariates:
          return None
      elif (
          static_covariates is not None
          and static_covariates.index.name == "component"
      ):
          if inverse_transform:
              cols_orig = series.n_components // n_midas
              return static_covariates[:cols_orig]
          else:
              return pd.concat([static_covariates] * n_midas)
      else:
          return static_covariates
  
file_path: darts/darts/dataprocessing/transformers/midas.py
imports: from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.dataprocessing.transformers import FittableDataTransformer, InvertibleDataTransformer
  from darts.logging import get_logger, raise_log
  from darts.timeseries import _finite_rows_boundaries
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 6 for calling the MIDAS obj's underlying member method code with example usage: obj._process_static_covariates(series, n_midas, drop_static_covariates, inverse_transform) and returns: None, static_covariates, static_covariates, pd