class_docstr: shared set-up checks and methods across imputers
class_docstr_tok: ["shared","set-up","checks","and","methods","across","imputers"]
docstr: Common checks before transforming data:
  
  - Check transformer was fit
  - Check that the input is a dataframe
  - Check that input has same size than the train set used in fit()
  - Re-orders dataframe features if necessary
  
  Parameters
  ----------
  X: Pandas DataFrame
  
  Returns
  -------
  X: Pandas DataFrame
      The same dataframe entered by the user.
docstr_tok: ["Common","checks","before","transforming","data",":","-","Check","transformer","was","fit","-","Check","that","the","input","is","a","dataframe","-","Check","that","input","has","same","size","than","the","train","set","used","in","fit","(",")","-","Re-orders","dataframe","features","if","necessary","Parameters","--","--","--","--","--","X",":","Pandas","DataFrame","Returns","--","--","--","-","X",":","Pandas","DataFrame","The","same","dataframe","entered","by","the","user","."]
code: def _transform(self, X: pd.DataFrame) -> pd.DataFrame:
      """
      Common checks before transforming data:
  
      - Check transformer was fit
      - Check that the input is a dataframe
      - Check that input has same size than the train set used in fit()
      - Re-orders dataframe features if necessary
  
      Parameters
      ----------
      X: Pandas DataFrame
  
      Returns
      -------
      X: Pandas DataFrame
          The same dataframe entered by the user.
      """
      # Check method fit has been called
      check_is_fitted(self)
  
      # check that input is a dataframe
      X = check_X(X)
  
      # Check that input df contains same number of columns as df used to fit
      _check_X_matches_training_df(X, self.n_features_in_)
  
      # reorder df to match train set
      X = X[self.feature_names_in_]
  
      return X
  
file_path: feature_engine/feature_engine/imputation/base_imputer.py
imports: import pandas
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils.validation import check_is_fitted
  from feature_engine.dataframe_checks import _check_X_matches_training_df, check_X
  from feature_engine._base_transformers.mixins import GetFeatureNamesOutMixin
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 1 for calling the BaseImputer obj's underlying member method code with example usage: obj._transform(X) and returns: X