diff --git a/0_1_Input_cleaning.py b/0_1_Input_cleaning.py index ec7eeeb..a7fc903 100644 --- a/0_1_Input_cleaning.py +++ b/0_1_Input_cleaning.py @@ -30,29 +30,29 @@ def export_dataset(df, output_name): df.to_csv(file_out, index = False) ## 1 - Cleaning of the datasets -for tenant_id in ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "101"): +for tenant_id in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "101"]: # Timer start = time.time() - # # Cleaning customerplus - # df1_customerplus_clean = preprocessing_customerplus(directory_path = tenant_id) - - # ## Exportation - # export_dataset(df = df1_customerplus_clean, output_name = "0_Input/Company_"+ tenant_id +"/customerplus_cleaned.csv") - - # # Cleaning target area - # df1_target_information = preprocessing_target_area(directory_path = tenant_id) - # ## Exportation - # export_dataset(df = df1_target_information, output_name = "0_Input/Company_"+ tenant_id +"/target_information.csv") - - # # Cleaning campaign area - # df1_campaigns_information = preprocessing_campaigns_area(directory_path = tenant_id) - # ## Exportation - # export_dataset(df = df1_campaigns_information, output_name = "0_Input/Company_"+ tenant_id +"/campaigns_information.csv") + # Cleaning customerplus + df1_customerplus_clean = preprocessing_customerplus(directory_path = tenant_id) ## Exportation - # export_dataset(df = df1_campaigns_information, output_name = "1_Temp/Company 1 - Campaigns dataset clean.csv") + export_dataset(df = df1_customerplus_clean, output_name = "0_Input/Company_"+ tenant_id +"/customerplus_cleaned.csv") + + # Cleaning target area + df1_target_information = preprocessing_target_area(directory_path = tenant_id) + ## Exportation + export_dataset(df = df1_target_information, output_name = "0_Input/Company_"+ tenant_id +"/target_information.csv") + + # Cleaning campaign area + df1_campaigns_information = preprocessing_campaigns_area(directory_path = tenant_id) + ## Exportation + export_dataset(df = df1_campaigns_information, output_name = "0_Input/Company_"+ tenant_id +"/campaigns_information.csv") + + # Exportation + export_dataset(df = df1_campaigns_information, output_name = "1_Temp/Company 1 - Campaigns dataset clean.csv") if tenant_id == "101": # Cleaning product area diff --git a/0_Cleaning_and_merge_functions.py b/0_Cleaning_and_merge_functions.py index c8144f5..64ec7d4 100644 --- a/0_Cleaning_and_merge_functions.py +++ b/0_Cleaning_and_merge_functions.py @@ -145,7 +145,7 @@ def preprocessing_tickets_area(directory_path): tickets.rename(columns = {'id' : 'ticket_id'}, inplace = True) if directory_path == '101': - tickets_1 = tickets[['id', 'purchase_id', 'product_id', 'is_from_subscription', 'type_of', 'supplier_id']] + tickets_1 = tickets_1[['id', 'purchase_id', 'product_id', 'is_from_subscription', 'type_of', 'supplier_id']] tickets_1.rename(columns = {'id' : 'ticket_id'}, inplace = True) # Base des fournisseurs @@ -294,6 +294,5 @@ def uniform_product_df(directory_path): products_purchased_reduced_1 = products_purchased_1[['ticket_id', 'customer_id', 'purchase_id' ,'event_type_id', 'supplier_name', 'purchase_date', 'amount', 'is_full_price', 'name_event_types', 'name_facilities', 'name_categories', 'name_events', 'name_seasons', 'start_date_time', 'end_date_time', 'open']] # 'type_of_ticket_name', 'children', return products_purchased_reduced, products_purchased_reduced_1 - else : return products_purchased_reduced \ No newline at end of file