Skip to content

Instantly share code, notes, and snippets.

@kshirsagarsiddharth
Created March 20, 2022 18:12
Show Gist options
  • Save kshirsagarsiddharth/b855e7ef3252460a4c1cce0059e993bf to your computer and use it in GitHub Desktop.
Save kshirsagarsiddharth/b855e7ef3252460a4c1cce0059e993bf to your computer and use it in GitHub Desktop.
# Remove categorical columns (will replace with one-hot encoding)
sc = StandardScaler()
sc_cols_train = pd.DataFrame(sc.fit_transform(X_train[numeric_columns]))
sc_cols_valid = pd.DataFrame(sc.transform(X_valid[numeric_columns]))
# One-hot encoding removed index; put it back
sc_cols_train.index = X_train.index
sc_cols_valid.index = X_valid.index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment