Sample dataframe -
| col1 | col2 | col3 | col4 | colfromvaluestobepicked | new col |
|---|---|---|---|---|---|
| 1 | 1 | 0 | 1 | 'col1' | 1 |
| 0 | 0 | 1 | 1 | 'col2' | 0 |
I want to create a new column whose values are based on if the colfromvaluestobepicked ('col1') is col1 then pick that col value and assign it to the new col and so on.
I am not sure how to achieve this?