code: def test_extract_features_from_variables_containing_nans():
      X = DatetimeFeatures(
          features_to_extract=["year"], missing_values="ignore"
      ).fit_transform(dates_nan)
      pd.testing.assert_frame_equal(
          X,
          pd.DataFrame({"dates_na_year": [2010, np.nan, 1922, np.nan]}),
      )
      # dt variable is index
      X = DatetimeFeatures(
          variables="index",
          features_to_extract=["month"],
          missing_values="ignore",
      ).fit_transform(dates_idx_nan)
      pd.testing.assert_frame_equal(
          X,
          pd.concat(
              [
                  dates_idx_nan,
                  pd.DataFrame(
                      {"month": [2, np.nan, 6, np.nan]},
                      index=dates_idx_nan.index,
                  ),
              ],
              axis=1,
          ),
      )
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.pipeline import Pipeline
  from feature_engine.datetime import DatetimeFeatures
  from feature_engine.datetime._datetime_constants import FEATURES_DEFAULT, FEATURES_SUFFIXES, FEATURES_SUPPORTED
label_desc: Use image node_id 21 for calling a global function with example usage: test_extract_features_from_variables_containing_nans() without return types