خرید بک لینک

Vote count: 0

I have data frame which represents if a customer bought certain items. The df looks as follows:

P1  P2  P3  P4  P5
1   2   0   0   0
1   1   0   0   0
0   0   0   3   0 
1   0   0   1   0
1   0   5   1   0
1   1   0   0   0

I am trying to create the occurrence of how many households purchased each item pair in the table. A snap shot of the result would like:

P1  P2  3
P1  P3  1
P1  P4  2
---------

As a first step, I converted the data in to a binary format - if the item was purchased. I am however, struggling with the function to convert it in to item pair group.

--- I am hoping to create a network graph using this data so maybe creating a matrix be of use too

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 29 خرداد 1395 ساعت: 2:11

صفحه بندی