Skip to content

Instantly share code, notes, and snippets.

@Wann-Jiun
Created January 19, 2017 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wann-Jiun/361aa6702f6c823eaa41a3cf6c95112a to your computer and use it in GitHub Desktop.
Save Wann-Jiun/361aa6702f6c823eaa41a3cf6c95112a to your computer and use it in GitHub Desktop.
from sklearn.preprocessing import StandardScaler
scaling = StandardScaler()
scaling.fit(train_df[numerical_features])
scaling_result = scaling.transform(train_df[numerical_features])
for i, col in enumerate(numerical_features):
train_df[col] = scaling_result[:, i]
scaling_result = scaler.transform(test_df_munged[numeric_features])
for i, col in enumerate(numeric_features):
test_df[col] = scaling_result[:, i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment