Machine Learning - Machine Learning Development Life Cycle - Column Transformer Tutorial
Column Transformer is a sciket-learn class used to create and apply separate transformers for numerical and categorical data. To create transformers we need to specify the transformer object and pass the list of transformations inside a tuple along with the column on which you want to apply the transformation.
Each transformer is a three-element tuple that defines the name of the transformer, the transform to apply, and the column indices to apply it to. For example:
(Name, Object, Columns)
Suppose to apply SimpleImputer() on fever column, then it will be in the form-
(‘tnf1’,SimpleImputer(),[‘fever’])
Where tnf1 is the name of the transformer
We need to apply below transformation using column transformer
- One hot encoder on gender and city
- Ordinal Encoder on cough
- Simple Imputer on fever