I have a dataframe with multiple columns like the following.
df
ID var_1 var_2 var_3 var_4 var_5
A 0 1 0 1 0
C 0 0 2 0 1
D 0 1 0 2 0
E 2 0 1 0 0
How do I add a new column that specify the name of the columns with value more than zero?
Desired output would be something like this:
df
ID var_1 var_2 var_3 var_4 var_5 vars_with_value
A 0 1 0 1 0 var_2, var_4
C 0 0 2 1 1 var_3, var_4, var_5
D 0 1 0 0 0 var_2
E 2 0 1 0 0 var_1, var_3
Any help would be much appreciated, thanks.