I have a panda DF as follows:
items_type item_id item_name item_price
A 1 x 1.0
A 2 y 1.1
A 3 z 0.75
B 4 x 2.0
B 5 w 2.5
B 6 z 1.5
C 7 x 0.2
C 8 w 11.0
C 9 n 5.0
I need to create a new df , dropping item_id, and flatten item_name, as in:
items_type x y z w n
A 1.0 1.1 0.75 None None
B 2.0 None 1.5 2.5 None
C 0.2 None None 11.0 5.0
Please advise if there is a way to do via pivot or otherwise without have to loop
Thank