Passage à demande input à boucle sur activite

This commit is contained in:
Antoine JOUBREL 2024-03-31 16:34:55 +00:00
parent 0a7900c07f
commit 35638f2a2d

View File

@ -21,54 +21,56 @@ companies = {'musee' : ['1', '2', '3', '4'], # , '101'
'musique' : ['10', '11', '12', '13', '14']} 'musique' : ['10', '11', '12', '13', '14']}
type_of_activity = input('Choisissez le type de compagnie : sport ? musique ? musee ?') # type_of_activity = input('Choisissez le type de compagnie : sport ? musique ? musee ?')
list_of_comp = companies[type_of_activity] for type_of_activity in ['musee', 'sport', 'musique'] :
# Load files list_of_comp = companies[type_of_activity]
customer, campaigns_kpi, campaigns_brut, tickets, products, targets = load_files(list_of_comp)
# Load files
# Identify anonymous customer for each company and remove them from our datasets customer, campaigns_kpi, campaigns_brut, tickets, products, targets = load_files(list_of_comp)
outlier_list = outlier_detection(tickets, list_of_comp)
# Identify anonymous customer for each company and remove them from our datasets
# Identify valid customer (customer who bought tickets after starting date or received mails after starting date) outlier_list = outlier_detection(tickets, list_of_comp)
customer_valid_list = valid_customer_detection(products, campaigns_brut)
# Identify valid customer (customer who bought tickets after starting date or received mails after starting date)
databases = [customer, campaigns_kpi, campaigns_brut, tickets, products] customer_valid_list = valid_customer_detection(products, campaigns_brut)
for dataset in databases: databases = [customer, campaigns_kpi, campaigns_brut, tickets, products]
dataset['customer_id'] = dataset['customer_id'].apply(lambda x: remove_elements(x, outlier_list))# remove outlier
dataset = dataset[dataset['customer_id'].isin(customer_valid_list)] # keep only valid customer for dataset in databases:
#print(f'shape of {dataset} : ', dataset.shape) dataset['customer_id'] = dataset['customer_id'].apply(lambda x: remove_elements(x, outlier_list))# remove outlier
dataset = dataset[dataset['customer_id'].isin(customer_valid_list)] # keep only valid customer
# Identify customer who bought during the period of y #print(f'shape of {dataset} : ', dataset.shape)
customer_target_period = identify_purchase_during_target_periode(products)
customer['has_purchased_target_period'] = np.where(customer['customer_id'].isin(customer_target_period), 1, 0) # Identify customer who bought during the period of y
customer_target_period = identify_purchase_during_target_periode(products)
# Generate graph and automatically saved them in the bucket customer['has_purchased_target_period'] = np.where(customer['customer_id'].isin(customer_target_period), 1, 0)
compute_nb_clients(customer, type_of_activity)
# Generate graph and automatically saved them in the bucket
#maximum_price_paid(customer, type_of_activity) compute_nb_clients(customer, type_of_activity)
target_proportion(customer, type_of_activity) #maximum_price_paid(customer, type_of_activity)
mailing_consent(customer, type_of_activity) target_proportion(customer, type_of_activity)
mailing_consent_by_target(customer) mailing_consent(customer, type_of_activity)
gender_bar(customer, type_of_activity) mailing_consent_by_target(customer)
country_bar(customer, type_of_activity) gender_bar(customer, type_of_activity)
lazy_customer_plot(campaigns_kpi, type_of_activity) country_bar(customer, type_of_activity)
campaigns_effectiveness(customer, type_of_activity) lazy_customer_plot(campaigns_kpi, type_of_activity)
sale_dynamics(products, campaigns_brut, type_of_activity) campaigns_effectiveness(customer, type_of_activity)
tickets_internet(tickets, type_of_activity) sale_dynamics(products, campaigns_brut, type_of_activity)
already_bought_online(tickets, type_of_activity) tickets_internet(tickets, type_of_activity)
box_plot_price_tickets(tickets, type_of_activity) already_bought_online(tickets, type_of_activity)
target_description(targets, type_of_activity) box_plot_price_tickets(tickets, type_of_activity)
target_description(targets, type_of_activity)