I have a Pandas Dataframe with a probability for each column and I have 10 columns. Row represents a record. I'd like to select top 3 probabilities and return that column names (kind of like argmax).
Since I have a large volume of rows, I don't want to use loop hopefully. Could someone help me do this?
The DataFrame looks like this:
col0 col1 col2 col3 col4 col5 col6 col7 col8 col9
0 0.089659 0.0 0.0 0.0 0.228481 0.000000 0.0 0.575523 0.0 0.089667
1 0.000000 0.0 0.0 0.0 0.000000 0.422125 0.0 0.516324 0.0 0.000000
2 0.000000 0.0 0.0 0.0 0.000000 0.304416 0.0 0.659216 0.0 0.000000
3 0.598459 0.0 0.0 0.0 0.100792 0.082668 0.0 0.144577 0.0 0.053502
4 0.100000 0.1 0.1 0.1 0.100000 0.100000 0.1 0.100000 0.1 0.100000