I have a dataframe (below there's a super simplified version) which has transactions data of product bought and device used:
CUST_ID PRODUCT DEVICE
----------------------
1 A MOBILE
1 B TABLET
2 B LAPTOP
2 A MOBILE
3 C TABLET
3 C TABLET
I would like to transform it in order to have frequencies of purchase for each product and device usage by single cust_id view: i.e. a dataframe (3x7)
CUST_ID PRODUCT_A PRODUCT_B PRODUCT_C DEVICE_MOBILE DEVICE_LAPTOP DEVICE_TABLET
1 1 1 0 1 0 1
2 1 1 0 1 1 0
3 0 0 2 0 0 2
I tried to use the .pivot_table() function, but it adds me indexes and duplicate columns. This is a simplified version, I would need to do this for many products and devices, so maybe a function or loop would be more efficient?