max_min_scaler = lambda x : (x-np.min(x))/(np.max(x)-np.min(x))
train_df['average_montly_hours']=train_df[['average_montly_hours']].apply(max_min_scaler)
train_df
函数
def Data_normalization(train):
max_min_scaler = lambda x : (x-np.min(x))/(np.max(x)-np.min(x))
dest_feature=['TransactionDT','TransactionAmt', 'card1','card2','card3','card5']
for name in dest_feature:
train_df[name]=train_df[[name]].apply(max_min_scaler)
return train_df
train_df=Data_normalization(train_df)
train_df