code: def _check_dataframe(
      model,
      df: pd.DataFrame,
      check_y: bool = True,
      exogenous: bool = True,
      future: Optional[bool] = None,
  ) -> pd.DataFrame:
      """Performs basic data sanity checks and ordering
  
      Prepare dataframe for fitting or predicting.
  
      Parameters
      ----------
          df : pd.DataFrame
              dataframe containing column ``ds``, ``y``, and optionally``ID`` with all data
          check_y : bool
              if df must have series values
  
              Note
              ----
              set to True if training or predicting with autoregression
          exogenous : bool
              whether to check covariates, regressors and events column names
          future : bool
              whether this function is called by make_future_dataframe()
  
      Returns
      -------
          pd.DataFrame
              checked dataframe
      """
      if len(df) < (model.n_forecasts + model.n_lags) and not future:
          raise ValueError(
              "Dataframe has less than n_forecasts + n_lags rows. "
              "Forecasting not possible. Please either use a larger dataset, or adjust the model parameters."
          )
      df, _, _, _ = df_utils.prep_or_copy_df(df)
      (
          df,
          regressors_to_remove,
          lag_regressors_to_remove,
      ) = df_utils.check_dataframe(
          df=df,
          check_y=check_y,
          covariates=model.config_lagged_regressors
          if exogenous
          else None,
          regressors=model.config_regressors if exogenous else None,
          events=model.config_events if exogenous else None,
          seasonalities=model.config_seasonality if exogenous else None,
          future=True if future else None,
      )
      if model.config_regressors is not None:
          for reg in regressors_to_remove:
              log.warning(
                  f"Removing regressor {reg} because it is not present in the data."
              )
              model.config_regressors.pop(reg)
          if len(model.config_regressors) == 0:
              model.config_regressors = None
      if model.config_lagged_regressors is not None:
          for reg in lag_regressors_to_remove:
              log.warning(
                  f"Removing lagged regressor {reg} because it is not present in the data."
              )
              model.config_lagged_regressors.pop(reg)
          if len(model.config_lagged_regressors) == 0:
              model.config_lagged_regressors = None
      return df
  
file_path: neural_prophet/neuralprophet/data/process.py
imports: import logging
  from typing import List, Optional
  import numpy
  import pandas
  from neuralprophet import df_utils, time_dataset
  from neuralprophet.configure import ConfigCountryHolidays, ConfigEvents, ConfigFutureRegressors, ConfigLaggedRegressors, ConfigSeasonality
  from neuralprophet.np_types import Components
label_desc: Use image node_id 5 for calling a global function with example usage: _check_dataframe(model, df, check_y, exogenous, future) and returns: df