>>> import mlxtend >>> from mlxtend.frequent_patterns import apriori >>> frequent_itemsets = apriori(df, min_support = 0.6, use_colnames = True) >>> frequent_itemsets support itemsets 0 0.6 (Apple) 1 0.8 (Beans) 2 0.6 (Cookie) 3 0.8 (Eggs) 4 0.6 (Milk) 5 0.6 (Yogurt) 6 0.6 (Eggs, Apple) 7 0.6 (Cookie, Beans) 8 0.6 (Eggs, Beans) 9 0.6 (Yogurt, Beans) 10 0.6 (Cookie, Eggs) 11 0.6 (Eggs, Cookie, Beans)
앞 결과는 발견한 패턴을 frequent_itemsets 데이터프레임에 표현한 것이다. 다음 절의 실습을 통해 이 패턴을 조금 더 정제해보자.