My dataset is an adjacency matrix comparable with customer buying information. An example toy dataset:
p = {'A': [0,1,0,1], 'B': [1,1,1,1], 'C': [0,0,1,1], 'D': [1,1,1,0]}
df = pd.DataFrame(data=p)
df
Now I am interested in the frequent itemset so I used an apriori fim:
from mlxtend.frequent_patterns import apriori
frequent_itemsets = apriori(df, min_support=0.1, use_colnames=True)
frequent_itemsets
Now we see that itemset (D,B) occurs in 75% of the dataset. But I am actually interested in which rows this itemset occurs since the index has some information (which customer bought these items).
Shortly, I am curious how I could filter in my dataset to see which rows correspond with a specific itemset. Is there such a feature within this package/library. So that I could filter that itemset (D,B) occurs in row 0,1 and 2?