I'd like to scale some (but not all) of the columns in a Pandas dataFrame using a MinMaxScaler. How can I do it?
Since sklearn >= 0.20 you can do it using Column Transformer
standard_transformer = Pipeline(steps=[
('standard', StandardScaler())])
minmax_transformer = Pipeline(steps=[
('minmax', MinMaxScaler())])
preprocessor = ColumnTransformer(
remainder='passthrough', #passthough features not listed
transformers=[
('std', standard_transformer , ['z']),
('mm', minmax_transformer , ['x','y'])
])