I have the following dataframe :
| id | Statement_1 | Statement_2 | Statement_3 |
|---|---|---|---|
| xyz | 0.0 | 1.0 | 0.0 |
| abc | 1.0 | 0.0 | 0.0 |
| efg | 0.0 | 0.0 | 1.0 |
I want to create a new column based on the condition, if a row have a 1.0, it return the column name associate with it.
More clearly, I would like this dataframe in return :
| id | Statement_1 | Statement_2 | Statement_3 | Condition |
|---|---|---|---|---|
| xyz | 0.0 | 1.0 | 0.0 | Statement_2 |
| abc | 1.0 | 0.0 | 0.0 | Statement_1 |
| efg | 0.0 | 0.0 | 1.0 | Statement_3 |
Thx to everyone who can help me with this !
![[1]: https://i.stack.imgur.com/2lzSk.png](https://i.stack.imgur.com/EUeJ5.png)