I have a data frame that looks like this:
df_dict = {'FamID' : [1, 2], 'Person_1' : ['Husband', 'Granpa'] , 'Person_2' : ['Wife', 'Grandson'], 'Higher_income' : [1, 0]}
df = pd.DataFrame(df_dict)
df = df.set_index('FamID')
It compares the income between household members. So for Higher_income column, 1 means Person_1 has the higher income and 0 means Person_2 does.
How can I stack this data frame so that the result looks like:
