I have a data frame that's something like this:
Keyword A B C D ... X Y Z
First 1 2 3 4 ... 8 5 3
Second 2 6 2 9 ... 6 1 2
Third 3 3 2 3 ... 5 3 4
I've also got a list letters which just has the column names from A to Z.
I want to get the keyword of the maximum value in each column.
If I want to get it for just one column, something like this works:
max = df['A'].max()
df.loc[df['A'] == max, 'Keyword']
A Third
How would I go about getting it for all the columns?
So that would be:
A Third
B Second
C First
D Second
...
X First
Y First
Z Third