Apply StandardScaler to parts of a data set
问题 I want to use sklearn 's StandardScaler . Is it possible to apply it to some feature columns but not others? For instance, say my data is: data = pd.DataFrame({'Name' : [3, 4,6], 'Age' : [18, 92,98], 'Weight' : [68, 59,49]}) Age Name Weight 0 18 3 68 1 92 4 59 2 98 6 49 col_names = ['Name', 'Age', 'Weight'] features = data[col_names] I fit and transform the data scaler = StandardScaler().fit(features.values) features = scaler.transform(features.values) scaled_features = pd.DataFrame(features,