code: def test_error_when_nan_in_index(df_time, estimator):
      X = df_time.copy()
  
      # Introduce NaN in index.
      tmp = X.head(1).copy()
      tmp.index = [np.nan]
      Xd = pd.concat([X, tmp], axis=0)
  
      transformer = clone(estimator)
  
      with pytest.raises(NotImplementedError):
          transformer.fit(Xd)
  
      transformer.fit(X)
      with pytest.raises(NotImplementedError):
          transformer.transform(Xd)
  
file_path: feature_engine/tests/test_time_series/test_forecasting/test_check_estimator_forecasting.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.base import clone
  from sklearn.utils.estimator_checks import check_estimator
  from feature_engine.timeseries.forecasting import ExpandingWindowFeatures, LagFeatures, WindowFeatures
  from tests.estimator_checks.estimator_checks import check_feature_engine_estimator
label_desc: Use image node_id 4 for calling a global function with example usage: test_error_when_nan_in_index(df_time, estimator) without return types