Feature Engineering for Machine Learning in Python
Robert O'Callaghan
Data Scientist
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
scaler.fit(df[['Age']])
df['normalized_age'] = scaler.transform(df[['Age']])
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(df[['Age']])
df['standardized_col'] = scaler\
.transform(df[['Age']])
from sklearn.preprocessing import PowerTransformer
log = PowerTransformer()
log.fit(df[['ConvertedSalary']])
df['log_ConvertedSalary'] =
log.transform(df[['ConvertedSalary']])
Feature Engineering for Machine Learning in Python