I have a dataframe dfon cafeteria food options:
Meal Food Cooked Percentage
Breakfast Yes Attended 1.00
Breakfast Apple No .25
Breakfast Oatmeal Yes .55
Breakfast Skipped Not .20
Lunch Yes Attended 1.00
Lunch Salad No .42
Lunch Pizza Yes .48
Lunch Skipped Not .10
I have tried pd.get_dummies() package, but that gives a binary encoding to the Cooked category column. I want to transform my dataset as such:
Meal Food Cooked Percentage No Yes Not
Breakfast Yes Attended 1.00 .25 .55 .20
Breakfast Apple No .25 .25 .55 .20
Breakfast Oatmeal Yes .55 .25 .55 .20
Breakfast Skipped Not .20 .25 .55 .20
Lunch Yes Attended 1.00 .42 .48 .10
Lunch Salad No .42 .42 .48 .10
Lunch Pizza Yes .48 .42 .48 .10
Lunch Skipped Not .10 .42 .48 .10
Hence, I am trying to transpose values of one column into new columns, based on values in a second column.