Say I have the following dataframe
date | car | cost | rev
--------+-----+------+-----
20200801 fiat 20 30
20200801 vw 10 15
20200802 fiat 21 29
20200802 audi 30 50
I would like to have a dataframe where each date
only exists once and then the information for all the cars as columns e.g
date | cost_fiat | cost_audi | cost_vw | rev_fiat | rev_audi | rev_vw|
--------+-----------+-----------+---------+----------+------------+-------+
20200801 20 Null 10 30 Null 15
20200802 21 30 Null 29 50 Null
I can do it by a lot of if/else, apply, groupby etc. but I wonder if there's a function in pandas that could do some of the "heavy" calculations.