class_docstr: A simple preprocessor.
  
  Detects variable types, encodes everything as floats
  for use with sklearn.
  
  Applies one-hot encoding, missing value imputation and scaling.
  
  Attributes
  ----------
  ct_ : ColumnTransformer
      Main container for all transformations.
  
  columns_ : pandas columns
      Columns of training data.
  
  dtypes_ : Series of dtypes
      Dtypes of training data columns.
  
  types_ : something
      Inferred input types.
  
  
  Parameters
  ----------
  scale : boolean, default=True
      Whether to scale continuous data.
  
  force_imputation : bool, default=True
      Whether to create imputers even if no training data is missing.
  
  verbose : int, default=0
      Control output verbosity.
class_docstr_tok: ["A","simple","preprocessor",".","Detects","variable","types",",","encodes","everything","as","floats","for","use","with","sklearn",".","Applies","one-hot","encoding",",","missing","value","imputation","and","scaling",".","Attributes","--","--","--","--","--","ct_",":","ColumnTransformer","Main","container","for","all","transformations",".","columns_",":","pandas","columns","Columns","of","training","data",".","dtypes_",":","Series","of","dtypes","Dtypes","of","training","data","columns",".","types_",":","something","Inferred","input","types",".","Parameters","--","--","--","--","--","scale",":","boolean",",","default=True","Whether","to","scale","continuous","data",".","force_imputation",":","bool",",","default=True","Whether","to","create","imputers","even","if","no","training","data","is","missing",".","verbose",":","int",",","default=0","Control","output","verbosity","."]
docstr: A reference implementation of a fitting function for a transformer.
  
  Parameters
  ----------
  X : array-like or sparse matrix of shape = [n_samples, n_features]
      The training input samples.
  y : None
      There is no need of a target in a transformer, yet the pipeline API
      requires this parameter.
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["A","reference","implementation","of","a","fitting","function","for","a","transformer",".","Parameters","--","--","--","--","--","X",":","array-like","or","sparse","matrix","of","shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","y",":","None","There","is","no","need","of","a","target","in","a","transformer",",","yet","the","pipeline","API","requires","this","parameter",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def fit(self, X, y=None):
      """A reference implementation of a fitting function for a transformer.
  
      Parameters
      ----------
      X : array-like or sparse matrix of shape = [n_samples, n_features]
          The training input samples.
      y : None
          There is no need of a target in a transformer, yet the pipeline API
          requires this parameter.
  
      Returns
      -------
      self : object
          Returns self.
      """
      if not isinstance(X, pd.DataFrame):
          X = pd.DataFrame(X)
  
      self.columns_ = X.columns
      self.dtypes_ = X.dtypes
      if self.types is None:
          # FIXME some sanity check?
          types = detect_types(X, verbose=self.verbose)
      else:
          types = self.types
  
      types = types.copy()
      types.loc[types.low_card_int_ordinal, "continuous"] = True
      types.loc[types.low_card_int_categorical, "categorical"] = True
  
      # go over variable blocks
      # check for missing values
      # scale etc
      steps_categorical = []
      if self.force_imputation or X.loc[
          :, types.categorical
      ].isna().any(axis=None):
          steps_categorical.append(
              SimpleImputer(
                  strategy="most_frequent", add_indicator=True
              )
          )
          ohe_args = (
              {"sparse_output": False}
              if _SKLEARN_VERSION >= "1.2"
              else {"sparse": False}
          )
          ohe = OneHotEncoder(
              categories="auto",
              handle_unknown="ignore",
              drop="if_binary",
              **ohe_args,
          )
          steps_categorical.append(ohe)
  
      pipe_categorical = make_pipeline(*steps_categorical)
  
      steps_continuous = []
      if (
          self.force_imputation
          or X.loc[:, types.continuous].isna().any(axis=None)
          or types["dirty_float"].any()
      ):
          # we could skip the imputer here, but if there's dirty
          # floats, they'll have NaN, and we reuse the cont pipeline
          steps_continuous.append(SimpleImputer(strategy="median"))
      if self.scale:
          steps_continuous.append(StandardScaler())
      # if X.loc[:, types['continuous']].isnull().values.any():
      # FIXME doesn't work if missing values only in dirty column
      pipe_continuous = make_pipeline(*steps_continuous)
      # FIXME only have one imputer/standard scaler in all
      # (right now copied in dirty floats and floats)
  
      pipe_dirty_float = make_pipeline(
          DirtyFloatCleaner(),
          make_column_transformer(
              (pipe_continuous, _select_cont),
              remainder="passthrough",
              verbose_feature_names_out=False,
          ),
      )
      # construct column transformer
      transformer_cols = []
      if types["continuous"].any():
          transformer_cols.append(
              ("continuous", pipe_continuous, types["continuous"])
          )
      if types["categorical"].any():
          transformer_cols.append(
              ("categorical", pipe_categorical, types["categorical"])
          )
      if types["dirty_float"].any():
          # FIXME we're not really handling this here any more? (yes we are)
          transformer_cols.append(
              ("dirty_float", pipe_dirty_float, types["dirty_float"])
          )
  
      if not len(transformer_cols):
          raise ValueError("No feature columns found")
      self.ct_ = ColumnTransformer(
          transformer_cols,
          sparse_threshold=0.1,
          verbose_feature_names_out=False,
      )
      self.ct_.fit(X)
  
      self.input_shape_ = X.shape
      self.types_ = types
      # Return the transformer
      return self
  
imports: from importlib.metadata import version
  from joblib import hash
  import warnings
  from warnings import warn
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.compose import make_column_transformer, ColumnTransformer
  from sklearn.impute import SimpleImputer
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import OneHotEncoder, StandardScaler
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 2 for calling the EasyPreprocessor obj's underlying member method code with example usage: obj.fit(X, y) and returns: self