I have a df like this
sale_id brand Qty
1 Toyota 1
1 Toyota 2
2 Honda 1
2 Toyota 1
3 Lexus 3
Is there a function to convert it to:
sale_id Toyota Honda Lexus
1 3 0 0
2 1 1 0
3 0 0 1
So basically I´m creating columns equal to the sum of all quantities bought per car type by sale_id.