Skip to content

Reorganizing Data Frame

2 messages · chris99, Henrique Dallazuanna

#
Hi I need some help trying to restructure a data frame:

I have:
food    transaction     quantity
pizza         BUY              5
pizza         SELL              3
apple         BUY              2
orange       SELL              1
pizza         BUY               2


And the data frame I want to make is:

food        BUY          SELL
pizza         7             3
apple         2             0
orange       0             1



I can't figure out the commands to use. Can anyone help?