0

correlation between the columns, corr returns a correlation matrix

corr = df.corr()

Enter the name of the column(variable) you want to select from the above correlation matrix

target_column = input(str())

Now Match the target_column with column name of correlation matrix to access values of the column.

new_list = [i for i in corr if corr.columns.values == re.match(r'\w+', target_column)] new_list


ValueError Traceback (most recent call last)

in () 5 6 # Now Match the target_column with column name of ----> 7 new_list = [i for i in corr if corr.columns.values == re.match(r'\w+', target_column)] 8 new_list

in (.0) 5 6 # Now Match the target_column with column name of ----> 7 new_list = [i for i in corr if corr.columns.values == re.match(r'\w+', target_column)] 8 new_list

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I am facing this error, what wrong I am doing in this code?

0 Answers0