docstr: Perform the transformation to new categorical data.
  
  Some encoders behave differently on whether y is given or not. This is mainly due to regularisation
  in order to avoid overfitting.
  On training data transform should be called with y, on test data without.
  
  Parameters
  ----------
  
  X : array-like, shape = [n_samples, n_features]
  y : array-like, shape = [n_samples] or None
  override_return_df : bool
      override self.return_df to force to return a data frame
  
  Returns
  -------
  
  p : array or DataFrame, shape = [n_samples, n_features_out]
      Transformed values with encoding applied.
docstr_tok: ["Perform","the","transformation","to","new","categorical","data",".","Some","encoders","behave","differently","on","whether","y","is","given","or","not",".","This","is","mainly","due","to","regularisation","in","order","to","avoid","overfitting",".","On","training","data","transform","should","be","called","with","y",",","on","test","data","without",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]","y",":","array-like",",","shape","=","[","n_samples","]","or","None","override_return_df",":","bool","override","self.return_df","to","force","to","return","a","data","frame","Returns","--","--","--","-","p",":","array","or","DataFrame",",","shape","=","[","n_samples",",","n_features_out","]","Transformed","values","with","encoding","applied","."]
code: def transform(self, X, y=None, override_return_df=False):
      """Perform the transformation to new categorical data.
  
      Some encoders behave differently on whether y is given or not. This is mainly due to regularisation
      in order to avoid overfitting.
      On training data transform should be called with y, on test data without.
  
      Parameters
      ----------
  
      X : array-like, shape = [n_samples, n_features]
      y : array-like, shape = [n_samples] or None
      override_return_df : bool
          override self.return_df to force to return a data frame
  
      Returns
      -------
  
      p : array or DataFrame, shape = [n_samples, n_features_out]
          Transformed values with encoding applied.
  
      """
      # first check the type
      X, y = convert_inputs(X, y, deep=True)
      self._check_transform_inputs(X)
      if y is not None and self.lab_encoder_ is not None:
          y = self.lab_encoder_.transform(y)
  
      if not list(self.cols):
          return X
  
      X = self._transform(X, y)
  
      return self._drop_invariants(X, override_return_df)
  
imports: from abc import abstractmethod
  from enum import Enum, auto
  import warnings
  import pandas
  import numpy
  import sklearn.base
  from pandas.api.types import is_object_dtype, is_string_dtype, is_numeric_dtype
  from pandas.core.dtypes.dtypes import CategoricalDtype
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.exceptions import NotFittedError
  from typing import Dict, List, Optional, Union
  from scipy.sparse import csr_matrix
  from sklearn.preprocessing import LabelEncoder
label_desc: Use image node_id 2 for calling the SupervisedTransformerMixin obj's underlying member method code with example usage: obj.transform(X, y, override_return_df) and returns: self, X