I have a data frame like this:
A1 A2 A3 ...A99 largest
0 3 4 6 11 11
1 1 8 2 ... 1 8
.
.
.
I created the column which contains the largest value in each row by using:
data['largest']=data.max(axis=1)
but I also want to get a column which contains the corresponding column name with the largest number, something like this:
A1 A2 A3 ...A99 largest name
0 3 4 6 11 11 A99
1 1 8 2 ... 1 8 A2
. .
. .
. .
I tried '.idxmax' but gave me an error'reduction operation 'argmax' not allowed for this dtype', can someone help me? Many thanks.