For example, I have a dataframe like this
df = {'name':['Jennifer','Vivian','Trisha'],
'married':[1,1,0],
'Mon': [0, 0,1],
'Tu':[1,0,0],
'Wed':[0,1,0]}
How can I melt the dummy variables into one column like this:
I tried to use pd.melt() but it just stacks the several columns into one and changes the length of the column. Could someone help me with this? Thank you in advance!