<jupyter_start><jupyter_text>end data preparation, the new data represent the item who has been bought together.<jupyter_code>basket.head()
def encode_units(x):
    if x <= 0:
        return 0
    if x >= 1:
        return 1

basket_sets = basket.applymap(encode_units)
basket_sets.drop('POSTAGE', inplace=True, axis=1)
frequent_itemsets = apriori(basket_sets, min_support=0.07, use_colnames=True)
rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)
rules[ (rules['lift'] >= 6) &
       (rules['confidence'] >= 0.8) ]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12937062937062938, 'fraction_numerical': 0.02097902097902098, 'mean_word_length': 5.2967032967032965, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '304217', 'license': 'MIT', 'n_tokens_mistral': 213, 'n_tokens_neox': 200, 'n_words': 45, 'path': 'day4/.ipynb_checkpoints/day4-checkpoint.ipynb', 'repo_name': 'mamitiana/100DaysOfCode', 'size': '572'}