I have a data like the following:
df
col1 col2 col3
0 0 1
1 0 0
and I would like to get a result saying in each row which column has the value 1 and return the column name to me. In each row with the columns of consideration, there will only be exactly one "1". There are other values which will be much larger than 1. Without making a new copy of the data with the only three columns, I want to know if there would be efficient ways to extract out the column name.