I have a dataframe which looks like the following:
column_1 column_2
2 3
6 4
5 5
.
.
.
I would like to return for each row of the above dataframe the name(s) of the column(s) which have the maximum value in that row; for example for the first row I want to return 'column_2', and for the third row it will return both column names since they both have the same value.
I have tried to achieve it by using Pandas's idxmax function; but this function returns only the first occurrence and ignores the rest of the possibilities; like in the example of the third row above, idxmax returns only 'column_1' instead of ['column_1', 'column_2'].
Any idea how to solve this problem. Thanks in advance for your help.