I have a dataset with all the order, customer and orderitem information. I wandt to expand my orderitems in new columns, but without losing the information about the customer
CustomerId    OrderId    Item
1    1    CD
1    1    DVD
2    2    CD
And the result should be somehow:
CustomerId    OrderId    CD    DVD
1    1    1    1
2    2    1    0
I tried
df2 = pd.concat([df, pd.get_dummies(df.Item)], axis='columns')
df2 = df2.groupby('CustomerId')
 
    