I would like to filter a datframe that has association rules results. I want antecedents that contain an element like H or L in my case. The antecedents are frozenset types. I tried Hrules but it is not working.
Hrules=fdem_rules['H' in fdem_rules['antecedents']]
Hrules=fdem_rules[frozenset({'H'}) in fdem_rules['antecedents']]
did not work
In the following example, I need only rows 46 and 89 as they have H.
df = pd.DataFrame({'antecedents': [frozenset({'N', 'M', '60'}), frozenset({'H', 'AorE'}), frozenset({'0-35', 'H', 'AorE', '60'}), frozenset({'AorE', 'M', '60', '0'}), frozenset({'0-35', 'F'})]})
antecedents
75 (N, M, 60)
46 (H, AorE)
89 (0-35, H, AorE, 60)
103 (AorE, M, 60, 0)
38 (0-35, F)