I am trying to create multiple dataframe with similar names. The names change based on a list, and also join an operating.
corr_C=train[train_C].apply(lambda x: x.corr(train['target'])).abs()
corr_C=corr_C.sort_values(ascending=False, inplace=True)
I have datasets of train_D, train_E and train_F, I want to apply the same function to those datasets accordingly.
Available solutions online only talk about loop across columns, but I need the function being changeable to create new dataframes.
list=['C','D','E','F']
for list in list:
corr_+list=train[train_list].apply(lambda x: x.corr(train['target'])).abs()
return corr_+list=corr_list.sort_values(ascending=False, inplace=True)
SyntaxError: invalid syntax