docs: def _get_target_encoder(self, x, y):
          """Return a mapping from categories to average target values.
          Args:
              x (pandas.Series): a categorical column to encode.
              y (pandas.Series): the target column
          Returns:
              target_encoder (dict): mapping from categories to average target values
          """
  
          assert len(x) == len(y)
  
          # NaN cannot be used as a key for dict. So replace it with a random integer
          df = pd.DataFrame({y.name: y, x.name: x.fillna(NAN_INT)})
          return df.groupby(x.name)[y.name].mean().to_dict()