code: def transform(self, X):
          
  
          for i, col in enumerate(X.columns):
              X_col = self._transform_col(X[col], i)
              if X_col is not None:
                  if i == 0:
                      X_new = X_col
                  else:
                      X_new = sparse.hstack((X_new, X_col))
  
              logger.debug('{} --> {} features'.format(
                  col, self.label_encoder.label_maxes[i])
              )
  
          return X_new
docs: Encode categorical columns into sparse matrix with one-hot-encoding.
  
          Args:
              X (pandas.DataFrame): categorical columns to encode
  
          Returns:
              X_new (scipy.sparse.coo_matrix): sparse matrix encoding categorical
                                               variables into dummy variables