From b71f842fe419a07c5b0a1482df51f07284e64410 Mon Sep 17 00:00:00 2001 From: arevelle-ensae Date: Thu, 29 Feb 2024 09:09:04 +0000 Subject: [PATCH] add prefix to customer_id --- 0_2_Dataset_construction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/0_2_Dataset_construction.py b/0_2_Dataset_construction.py index 26e3ad3..917dee9 100644 --- a/0_2_Dataset_construction.py +++ b/0_2_Dataset_construction.py @@ -122,7 +122,10 @@ def dataset_construction(min_date, end_features_date, max_date, directory_path): dataset = pd.merge(df_customer_product, y, on = ['customer_id'], how = 'left') # 0 if there is no purchase - dataset[['y_has_purchased']].fillna(0) + dataset[['y_has_purchased']].fillna(0) + + # add id_company prefix to customer_id + dataset['customer_id'] = directory_path + '_' + dataset['customer_id'].astype('str') return dataset