LearnPy Hub
← Exploratory Data Analysis (EDA) problems
Hard

Which Feature Matters Most?

All columns are numbers and one is called target. Print the other column with the strongest correlation to target (largest absolute value; ties go to the earlier column) and that correlation with 2 decimals. Then print positive or negative.

Input

A CSV table: a header line, then one line per row (an empty field means a missing value), then a line END.

Output

Two lines: column r, then positive or negative.

Sample 1

Input
hours,sleep,target
1,8,40
2,6,52
3,8,50
4,6,66
5,7,64
6,5,75
END
Output
hours 0.95
positive

Sample 2

Input
price,ads,target
10,1,100
12,3,85
14,2,82
16,5,70
18,4,60
END
Output
price -0.99
negative
solution.py
Output appears here
Hints
Which Feature Matters Most? · Python practice problem · LearnPy Hub