Correction erreur pour entreprise 101

This commit is contained in:
Antoine JOUBREL 2024-02-27 21:52:13 +00:00
parent 23981e3cbc
commit 3c4f851d16
2 changed files with 18 additions and 19 deletions

View File

@ -30,29 +30,29 @@ def export_dataset(df, output_name):
df.to_csv(file_out, index = False) df.to_csv(file_out, index = False)
## 1 - Cleaning of the datasets ## 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 # Timer
start = time.time() start = time.time()
# # Cleaning customerplus # Cleaning customerplus
# df1_customerplus_clean = preprocessing_customerplus(directory_path = tenant_id) 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")
## Exportation ## 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": if tenant_id == "101":
# Cleaning product area # Cleaning product area

View File

@ -145,7 +145,7 @@ def preprocessing_tickets_area(directory_path):
tickets.rename(columns = {'id' : 'ticket_id'}, inplace = True) tickets.rename(columns = {'id' : 'ticket_id'}, inplace = True)
if directory_path == '101': 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) tickets_1.rename(columns = {'id' : 'ticket_id'}, inplace = True)
# Base des fournisseurs # 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', 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 return products_purchased_reduced, products_purchased_reduced_1
else : else :
return products_purchased_reduced return products_purchased_reduced