0

I am stuck in caluculating the highest of the 3 columns and respctive category as per the dataset:

<Dataset Image>

I want to calculate the max confidence category with confidence level and create a dataset with 4 columns like: TC_Name Failure MaxErrCategory MaxConfidence

I have tried capturing the max confidence level for each row but unable to figure out the category:

max_conf=data.max(axis=1)

Kindly help..

1 Answers1

1

The idxmax method of the dataframe will give you, for each row, the name of the column where the first occurrence of the maximum has been found.

data.idxmax(axis=1)

As you have strings in some of your columns, you should first select the columns on which you want to compute the max:

data[ ["confidence1", "confidence2", "confidence3"] ].idxmax(axis=1)
Olivier CAYROL
  • 256
  • 2
  • 5