I am currently struggling with the pandas framework.
Let's imagine the following Data Frame:
customer | order_number | product
------------------------------------
A | O1 | Product_1
A | O1 | Product_2
A | O2 | Product_X
B | O5 | Product_1
C | O6 | Product_2
C | 06 | Product_X
What I am trying to do is to count the occurences of "products" based on "order_number". This means that I would like to know how how often e.g. Product_1 and Product_2 were sold within one order. Of course I am interested in every available combination of products. I tried to use df.groupby['order_number'].count()
but this is certainly not the data I want. At this point I am not interested in order_numbers nor the customers! Just the available sets of products and how often they appear within the data frame.
Thanks in advance!
Update: Based on my example this explains what I would like to get
Product_1 && Product_2 | One Time
Product_X | One Time
Product_1 | One Time
Product_2 && Product_X | One Time