These examples use the same grocery data (grocery_transaction) for a sample of five transactions or customers. The function outputs the different combinations of two items (basket size of 2) grouped by the transaction id (tranid).
tranid | period | storeid | region | item | sku | category |
---|---|---|---|---|---|---|
999 | 20100715 | 1 | west | milk | 1 | dairy |
999 | 20100715 | 1 | west | butter | 2 | dairy |
999 | 20100715 | 1 | west | eggs | 3 | dairy |
999 | 19990715 | 1 | west | flour | 4 | baking |
999 | 19990715 | 1 | west | spinach | 4 | produce |
1000 | 20100715 | 1 | west | milk | 1 | dairy |
1000 | 20100715 | 1 | west | eggs | 3 | dairy |
1000 | 19990715 | 1 | west | flour | 4 | baking |
1000 | 19990715 | 1 | west | spinach | 2 | produce |
1001 | 20100715 | 1 | west | milk | 1 | dairy |
1001 | 20100715 | 1 | west | butter | 2 | dairy |
1001 | 20100715 | 1 | west | eggs | 3 | dairy |
1002 | 20100715 | 1 | west | milk | 1 | dairy |
1002 | 20100715 | 1 | west | butter | 2 | dairy |
1002 | 20100715 | 1 | west | spinach | 3 | produce |
1500 | 20100715 | 3 | west | butter | 2 | dairy |
1500 | 20100715 | 3 | west | eggs | 3 | dairy |
1500 | 20100715 | 3 | west | flour | 4 | baking |