I have a DataFrame in python by using pandas which has 3 columns and 80.000.000 rows.The Columns are: {event_id,device_id,category}.[]each device has many events and each event can have more than one category.I want to run Apriori algorithm to find out which categories seem together.My idea is to create a list of lists[[]]: to save the categories which are in the same event for each device. like: [('a'),('a','b')('d'),('s','a','b')] then giving the list of lists as transactions to the algorithm. I need help to create the list of lists.If you have better idea please tell me because I am new in Python and this was the only way I found out.
Run Apriori algorithm in python 2.7
python;dataset;pandas;association rules
df.groupby('device_id')['category'].apply(list).tolist()There's your transactions LOL.If you aren't limited to Python 2.7, I'd suggest Orange3-Associate which contains a frequent_itemsets() function based on FP-growth algorithm, which is orders of magnitude faster than Apriori.