<jupyter_start><jupyter_text>Streamlit Data Preprocessing<jupyter_code>import pandas as pd
import numpy as np
rules = pd.read_csv('results/rules_50_percent.csv')
rules.head()
# rename column names for the streamlit app markdown text
rules.rename(columns = {'antecedent':'Antecedent','consequent_1':'Frequently Purchased Item', 'consequent_2': 'Frequently Purchased Item','confidence_level':'Confidence Level'}, inplace = True)
rules.head()
rules.to_csv('data/rules_50_percent_app.csv', index = False)
# explore what antecedents are most common 
rules['Antecedent'].value_counts(normalize = True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1184, 'fraction_numerical': 0.0096, 'mean_word_length': 8.936507936507937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '371243', 'license': 'CC0-1.0', 'n_tokens_mistral': 212, 'n_tokens_neox': 196, 'n_words': 45, 'path': 'streamlit/app_preprocessing.ipynb', 'repo_name': 'aakiyanova/Capstone', 'size': '625'}