04pallav
9/11/2017 - 10:23 PM

Scaling features

Scaling features

from sklearn.preprocessing import StandardScaler, MinMaxScaler

# Standarize the features
scaler = StandardScaler().fit(X_train)
X_train = scaler.transform(X_train)

X_test = scaler.transform(X_test)

#adding column names again after normalizing
X_imputed_df = pd.DataFrame(X_imputed, columns = X_train.columns)




####################################
#fitting and transforming in the same step keping other columns in place ###best
df_feature.ix[:,2:] = scaler.fit_transform(df_feature.ix[:,2:])