SKLearn MinMaxScaler - scale specific columns only
问题 I'd like to scale some (but not all) of the columns in a Pandas dataFrame using a MinMaxScaler. How can I do it? 回答1: 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',