class_docstr: Calculates the mean target value per category or per bin of a variable or group of
  variables. Works with numerical and categorical variables. If variables are
  numerical, the values are first sorted into bins of equal-width or equal-frequency.
  
  Parameters
  ----------
  variables: list, default=None
      The list of input variables. If None, the estimator will use all variables as
      input features (except datetime).
  
  bins: int, default=5
      If the dataset contains numerical variables, the number of bins into which
      the values will be sorted.
  
  strategy: str, default='equal_width'
      Whether the bins should of equal width ('equal_width') or equal frequency
      ('equal_frequency').
  
  Attributes
  ----------
  variables_categorical_:
      The group of categorical input variables that will be used for prediction.
  
  variables_numerical_:
      The group of numerical input variables that will be used for prediction.
  
  binner_dict_:
       Dictionary with the interval limits per numerical variable.
  
  encoder_dict_:
      Dictionary with the mean target value per category or interval, per variable.
  
  n_features_in_:
      The number of features in the train set used in fit.
  
  feature_names_in_:
      List with the names of features seen during `fit`.
  
  See Also
  --------
  feature_engine.encoding.MeanEncoder
  feature_engine.discretisation.EqualWidthDiscretiser
  feature_engine.discretisation.EqualFrequencyDiscretiser
  
  References
  ----------
  Adapted from:
  
  .. [1] Miller, et al. "Predicting customer behaviour: The University of Melbourne’s
      KDD Cup report". JMLR Workshop and Conference Proceeding. KDD 2009
      http://proceedings.mlr.press/v7/miller09/miller09.pdf
docstr:  Replace original values by the average of the target mean value per bin or
   category in each one of the variables.
  
   Parameters
   ----------
   X : pandas dataframe of shape = [n_samples, n_features]
       The input samples.
  
   Return
   -------
  X_new: pandas dataframe of shape = [n_samples, n_features]
      The transformed data with the discrete variables.
docstr_tok: ["Replace","original","values","by","the","average","of","the","target","mean","value","per","bin","or","category","in","each","one","of","the","variables",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","input","samples",".","Return","--","--","--","-","X_new",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","transformed","data","with","the","discrete","variables","."]
code: def _transform(self, X: pd.DataFrame) -> pd.DataFrame:
      """
       Replace original values by the average of the target mean value per bin or
       category in each one of the variables.
  
       Parameters
       ----------
       X : pandas dataframe of shape = [n_samples, n_features]
           The input samples.
  
       Return
       -------
      X_new: pandas dataframe of shape = [n_samples, n_features]
          The transformed data with the discrete variables.
      """
      # check method fit has been called
      check_is_fitted(self)
  
      # check that input is a dataframe
      X = check_X(X)
  
      # Check input data contains same number of columns as df used to fit
      _check_X_matches_training_df(X, self.n_features_in_)
  
      # check for missing values
      _check_contains_na(X, self.variables_numerical_)
      _check_contains_na(X, self.variables_categorical_)
  
      # check inf
      _check_contains_inf(X, self.variables_numerical_)
  
      # reorder dataframe to match train set
      X = X[self.feature_names_in_]
  
      # transform dataframe
      X_tr = self._pipeline.transform(X)
  
      return X_tr
  
imports: from typing import List, Union
  import numpy
  import pandas
  from sklearn.base import BaseEstimator
  from sklearn.pipeline import Pipeline
  from sklearn.utils.validation import check_is_fitted
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine._variable_handling.variable_type_selection import _find_categorical_and_numerical_variables
  from feature_engine.dataframe_checks import _check_contains_inf, _check_contains_na, _check_X_matches_training_df, check_X, check_X_y
  from feature_engine.discretisation import EqualFrequencyDiscretiser, EqualWidthDiscretiser
  from feature_engine.encoding import MeanEncoder
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 7 for calling the BaseTargetMeanEstimator obj's underlying member method code with example usage: obj._transform(X) and returns: X_tr