Categories
Mastering Development

Pandas advanced column creation from another dataframe

I have a dataframe like below: df_detail = car_brand car_type 0 Toyota Sedan 1 Toyota Truck 2 Honda Truck 3 Mazda Sedan 4 Mazda Convertible I want to create a summary dataframe like below: df_summary= ID car_brand count_Sedan count_Truck count_Convertible 0 Toyota 1 1 0 1 Honda 0 1 0 2 Mazda 1 0 1 […]