With the following statement:
rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1.2)
I get a data frame of rules in the format:
frozenset({'Co_Apples'})
But I need to extract a Co_Apples
as a string.
How can I do that?
rules["antecedents"] = rules["antecedents"].apply(lambda x: ', '.join(list(x))).astype("unicode")
It is work for me. Thanks Frank Herfert save my day!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With