Skip to content

Instantly share code, notes, and snippets.

@PranjalDureja0002
Created March 15, 2021 09:51
Show Gist options
  • Save PranjalDureja0002/700f13397186e4846379670f6863f721 to your computer and use it in GitHub Desktop.
Save PranjalDureja0002/700f13397186e4846379670f6863f721 to your computer and use it in GitHub Desktop.
model
min_max_scaler = preprocessing.MinMaxScaler()
def scale_fun(X_train,X_test,col):
min_max_scaler.fit(X_train[col].values.reshape(-1,1))
X_train_=min_max_scaler.transform(X_train[col].values.reshape(-1,1))
X_test_=min_max_scaler.transform(X_test[col].values.reshape(-1,1))
return X_train_,X_test_
for col in X_train.columns:
X_train_,X_test_= scale_fun(X_train,X_test,col)
X_train[col] = X_train_
X_test[col] = X_test_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment