class_docstr: TimeSeriesLearner encompasses a full time series learning problem for a
  training run, and keeps track of datasets, features, and the trainer object.
class_docstr_tok: ["TimeSeriesLearner","encompasses","a","full","time","series","learning","problem","for","a","training","run",",","and","keeps","track","of","datasets",",","features",",","and","the","trainer","object","."]
docstr: Select the relevant item_ids and timestamps from the known_covariates dataframe.
  
  If some of the item_ids or timestamps are missing, an exception is raised.
docstr_tok: ["Select","the","relevant","item_ids","and","timestamps","from","the","known_covariates","dataframe",".","If","some","of","the","item_ids","or","timestamps","are","missing",",","an","exception","is","raised","."]
code: def _align_covariates_with_forecast_index(
      self,
      known_covariates: Optional[TimeSeriesDataFrame],
      data: TimeSeriesDataFrame,
  ) -> Optional[TimeSeriesDataFrame]:
      """Select the relevant item_ids and timestamps from the known_covariates dataframe.
  
      If some of the item_ids or timestamps are missing, an exception is raised.
      """
      if len(self.known_covariates_names) == 0:
          return None
      if (
          len(self.known_covariates_names) > 0
          and known_covariates is None
      ):
          raise ValueError(
              f"known_covariates {self.known_covariates_names} for the forecast horizon should be provided at prediction time."
          )
  
      if self.target in known_covariates.columns:
          known_covariates = known_covariates.drop(self.target, axis=1)
  
      missing_item_ids = data.item_ids.difference(
          known_covariates.item_ids
      )
      if len(missing_item_ids) > 0:
          raise ValueError(
              f"known_covariates are missing information for the following item_ids: {reprlib.repr(missing_item_ids.to_list())}."
          )
  
      forecast_index = get_forecast_horizon_index_ts_dataframe(
          data, prediction_length=self.prediction_length
      )
      try:
          known_covariates = known_covariates.loc[forecast_index]
      except KeyError:
          raise ValueError(
              f"known_covariates should include the values for prediction_length={self.prediction_length} "
              "many time steps into the future."
          )
      return known_covariates
  
imports: import logging
  import reprlib
  import time
  from typing import Any, Dict, List, Optional, Type, Union
  import pandas
  from autogluon.core.learner import AbstractLearner
  from autogluon.timeseries.dataset.ts_dataframe import TimeSeriesDataFrame
  from autogluon.timeseries.metrics import TimeSeriesScorer, check_get_evaluation_metric
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
  from autogluon.timeseries.splitter import AbstractWindowSplitter
  from autogluon.timeseries.trainer import AbstractTimeSeriesTrainer, AutoTimeSeriesTrainer
  from autogluon.timeseries.utils.features import TimeSeriesFeatureGenerator
  from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
label_desc: Use image node_id 5 for calling the TimeSeriesLearner obj's underlying member method code with example usage: obj._align_covariates_with_forecast_index(known_covariates, data) and returns: known_covariates, None