text_plain_output_1.png
from mlxtend.frequent_patterns import apriori, association_rules,fpgrowth,fpmax

from mlxtend.preprocessing import TransactionEncoder

from mlxtend.preprocessing import TransactionEncoder

import pandas as pd

data = pd.read_csv('../input/groceries-dataset/Groceries_dataset.csv')

data.shape

all_transactions = [transaction[1]['itemDescription'].tolist() for transaction in list(data.groupby(['Member_number', 'Date']))]

trans_encoder = TransactionEncoder()
trans_encoder_matrix = trans_encoder.fit(all_transactions).transform(all_transactions)
trans_encoder_matrix = pd.DataFrame(trans_encoder_matrix, columns=trans_encoder.columns_)

fmax = fpmax(trans_encoder_matrix, min_support=0.01, use_colnames=True)
fmax.head()