how to convert the row values to columns with the count of purchases without using the index of customer
DATA :
customer    fruits  veggies grocery
A   apple   carrot  brush
A   apple   carrot  brush
A   apple   onion   soap
A   banana  onion   soap
B   mango   onion   soap
B   mango   carrot  brush
B   banana  tomato  powder
B   banana  tomato  powder
C   apple   carrot  powder
C   mango   carrot  soap
C   mango   tomato  soap
C   banana  tomato  brush
D   banana  carrot  brush
D   banana  onion   soap
D   apple   tomato  powder
D   apple   tomato  powder
Expected Output :
customer    apple   mango   banana  carrot  onion   tomato  brush   soap    powder
A   3   0   1   2   2   0   2   2   0
B   0   2   2   1   1   2   1   1   2
C   1   2   1   2   0   2   1   2   1
D   2   0   2   1   1   2   1   1   2
 
     
    