Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# min-max normalization (numeric variables)
min_max_columns = ['tenure', 'MonthlyCharges', 'TotalCharges']
# scale numerical variables using min max scaler
for column in min_max_columns:
# minimum value of the column
min_column = df_telco_transformed[column].min()
# maximum value of the column
max_column = df_telco_transformed[column].max()
# min max scaler
df_telco_transformed[column] = (df_telco_transformed[column] - min_column) / (max_column - min_column)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment