From 53f32000b53bc41c6ce87515eda4376cb1ce693a Mon Sep 17 00:00:00 2001 From: ajoubrel-ensae Date: Sat, 16 Mar 2024 14:47:46 +0000 Subject: [PATCH] Changement sur customerplus --- 0_Cleaning_and_merge_functions.py | 2 +- 0_KPI_functions.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/0_Cleaning_and_merge_functions.py b/0_Cleaning_and_merge_functions.py index 64ec7d4..35262d0 100644 --- a/0_Cleaning_and_merge_functions.py +++ b/0_Cleaning_and_merge_functions.py @@ -74,7 +74,7 @@ def preprocessing_customerplus(directory_path): cleaning_date(customerplus_copy, 'last_visiting_date') # Selection des variables - customerplus_copy.drop(['lastname', 'firstname', 'birthdate', 'profession', 'language', 'age', 'email', 'civility', 'note', 'extra', 'reference', 'extra_field', 'need_reload', 'preferred_category', 'preferred_supplier', 'preferred_formula', 'zipcode', 'last_visiting_date'], axis = 1, inplace=True) + customerplus_copy.drop(['lastname', 'firstname', 'birthdate', 'language', 'email', 'civility', 'note', 'extra', 'reference', 'extra_field', 'need_reload', 'preferred_category', 'preferred_supplier', 'preferred_formula', 'mcp_contact_id' 'last_visiting_date', 'deleted_at'], axis = 1, inplace=True) customerplus_copy.rename(columns = {'id' : 'customer_id'}, inplace = True) return customerplus_copy diff --git a/0_KPI_functions.py b/0_KPI_functions.py index 26b6814..a8828ce 100644 --- a/0_KPI_functions.py +++ b/0_KPI_functions.py @@ -97,6 +97,7 @@ def customerplus_kpi_function(customerplus_clean = None): gender_dummies = pd.get_dummies(customerplus_clean["gender_label"], prefix='gender').astype(int) customerplus_clean = pd.concat([customerplus_clean, gender_dummies], axis=1) + customerplus_clean['opt_in'] = np.multiply(customersplus['opt_in'], 1) ## Indicatrice si individue vit en France customerplus_clean["country_fr"] = customerplus_clean["country"].apply(lambda x : int(x=="fr") if pd.notna(x) else np.nan)