Reputation: 55
I am trying get the list of features of my dataset greater than 0.15 It code let me do it but I have as result a serie panda that I cant retrieve the column names in a list to after do the drop of them in my dataset. I appreciate your help.
# Remove highly correlated features
cor = features_binario.corr()
#Correlation with output variable
cor_target = abs(cor["G3"])
#Selecting highly correlated features
relevant_features = cor_target[cor_target>0.15]
first_column = relevant_features.iloc[:,0]
first_column
I am getting this error, IndexingError: Too many indexers
Var: relevant_features
school_GP 0.177564
school_MS 0.177564
higher_no 0.251587
higher_yes 0.251587
course_math 0.168394
course_por 0.168394
age 0.153819
Medu 0.184047
Fedu 0.183627
failures 0.390165
G1 0.701693
G2 0.717439
G3 1.000000
Name: G3, dtype: float64
Upvotes: 1
Views: 1839
Reputation: 862581
It is Series
, so no columns.
For all values by conditions use:
relevant_features = cor_target.index[cor_target>0.15]
Upvotes: 2