Modification avec 101

This commit is contained in:
Antoine JOUBREL 2024-03-05 19:26:41 +00:00
parent 1308484706
commit 3ec803d0a6

View File

@ -66,6 +66,10 @@ def dataset_construction(min_date, end_features_date, max_date, directory_path):
df_customerplus_clean_0 = display_databases(directory_path, file_name = "customerplus_cleaned")
df_campaigns_information = display_databases(directory_path, file_name = "campaigns_information", datetime_col = ['opened_at', 'sent_at', 'campaign_sent_at'])
df_products_purchased_reduced = display_databases(directory_path, file_name = "products_purchased_reduced", datetime_col = ['purchase_date'])
# if directory_path == "101":
# df_products_purchased_reduced_1 = display_databases(directory_path, file_name = "products_purchased_reduced_1", datetime_col = ['purchase_date'])
# df_products_purchased_reduced = pd.concat([df_products_purchased_reduced, df_products_purchased_reduced_1])
# Filtre de cohérence pour la mise en pratique de notre méthode
max_date = pd.to_datetime(max_date, utc = True, format = 'ISO8601')
@ -131,7 +135,7 @@ def dataset_construction(min_date, end_features_date, max_date, directory_path):
## Exportation
companies = {'musee' : ['1', '2', '3', '4', '101'],
companies = {'musee' : ['1', '2', '3', '4'], # , '101'
'sport': ['5', '6', '7', '8', '9'],
'musique' : ['10', '11', '12', '13', '14']}
@ -147,10 +151,16 @@ start_date = "2021-05-01"
end_of_features = "2022-11-01"
final_date = "2023-11-01"
anonymous_customer = {'1' : 1, '2' : 12184, '3' : 1, '4' : 2, '101' : 1,
'5' : 191835, '6' : 591412, '7' : 49632, '8' : 1942, '9' : 19683}
for company in list_of_comp:
dataset_test = dataset_construction(min_date = start_date, end_features_date = end_of_features,
max_date = final_date, directory_path = company)
# On retire le client anonyme
dataset_test = dataset_test[dataset_test['customer_id'] != anonymous_customer[company]]
# Exportation
FILE_KEY_OUT_S3 = "dataset_test" + company + ".csv"
FILE_PATH_OUT_S3 = BUCKET_OUT + "/Test_set/" + FILE_KEY_OUT_S3