code: def transform(self, X):
          
          check_is_fitted(self, "encoded_columns_")
          check_columns_exist(X.columns, self.feature_names_)
  
          Xt = X.copy()
          for col, cat in self.categories_.items():
              Xt[col].cat.set_categories(cat, inplace=True)
  
          new_data = self._encode(Xt, self.feature_names_)
          return new_data.loc[:, self.encoded_columns_]
docs: Convert categorical columns to numeric values.
  
          Parameters
          ----------
          X : pandas.DataFrame
              Data to encode.
  
          Returns
          -------
          Xt : pandas.DataFrame
              Encoded data.