code: def transform(self, X, y=None):
          
          check_is_fitted(self, "categories_")
          X = self._check_array(X).copy()
          categories = self.categories_
  
          for k, dtype in categories.items():
              if _HAS_CTD:
                  if not isinstance(dtype, pd.api.types.CategoricalDtype):
                      dtype = pd.api.types.CategoricalDtype(*dtype)
                  X[k] = X[k].astype(dtype)
              else:
                  cat, ordered = dtype
                  X[k] = X[k].astype("category").cat.set_categories(cat, ordered)
  
          return X
docs: Transform the columns in ``X`` according to ``self.categories_``.
  
          Parameters
          ----------
          X : pandas.DataFrame or dask.DataFrame
          y : ignored
  
          Returns
          -------
          X_trn : pandas.DataFrame or dask.DataFrame
              Same type as the input. The columns in ``self.categories_`` will
              be converted to categorical dtype.