Ajout KPI sur customerplus
This commit is contained in:
parent
ab3b033f09
commit
cc30d7deb9
|
@ -93,14 +93,31 @@ def customerplus_kpi_function(customerplus_clean = None):
|
||||||
1: 'male',
|
1: 'male',
|
||||||
2: 'other'
|
2: 'other'
|
||||||
})
|
})
|
||||||
|
|
||||||
gender_dummies = pd.get_dummies(customerplus_clean["gender_label"], prefix='gender').astype(int)
|
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 = pd.concat([customerplus_clean, gender_dummies], axis=1)
|
||||||
|
|
||||||
customerplus_clean['opt_in'] = np.multiply(customersplus['opt_in'], 1)
|
# Age
|
||||||
## Indicatrice si individue vit en France
|
customerplus_clean['categorie_age_0_10'] = ((customerplus_clean['age'] >= 0) & (customerplus_clean['age'] < 10)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_10_20'] = ((customerplus_clean['age'] >= 10) & (customerplus_clean['age'] < 20)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_20_30'] = ((customerplus_clean['age'] >= 20) & (customerplus_clean['age'] < 30)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_30_40'] = ((customerplus_clean['age'] >= 30) & (customerplus_clean['age'] < 40)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_40_50'] = ((customerplus_clean['age'] >= 40) & (customerplus_clean['age'] < 50)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_50_60'] = ((customerplus_clean['age'] >= 50) & (customerplus_clean['age'] < 60)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_60_70'] = ((customerplus_clean['age'] >= 60) & (customerplus_clean['age'] < 70)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_70_80'] = ((customerplus_clean['age'] >= 70) & (customerplus_clean['age'] < 80)).astype(int)
|
||||||
|
customerplus_clean['categorie_age_plus_80'] = (customerplus_clean['age'] >= 80).astype(int)
|
||||||
|
customerplus_clean['categorie_age_inconnue'] = customerplus_clean['age'].apply(lambda x: 1 if pd.isna(x) else 0)
|
||||||
|
|
||||||
|
# Consentement au mailing
|
||||||
|
customerplus_clean['opt_in'] = customerplus_clean['opt_in'].astype(int)
|
||||||
|
|
||||||
|
# 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)
|
customerplus_clean["country_fr"] = customerplus_clean["country"].apply(lambda x : int(x=="fr") if pd.notna(x) else np.nan)
|
||||||
|
|
||||||
|
customerplus_clean['is_profession_known'] = customerplus_clean['profession'].notna().astype(int)
|
||||||
|
|
||||||
|
customerplus_clean['is_zipcode_known'] = customerplus_clean['zipcode'].notna().astype(int)
|
||||||
|
|
||||||
# Dummy if the customer has a structure id (tags)
|
# Dummy if the customer has a structure id (tags)
|
||||||
# customerplus_clean['has_tags'] = customerplus_clean['structure_id'].apply(lambda x: 1 if not pd.isna(x) else 0)
|
# customerplus_clean['has_tags'] = customerplus_clean['structure_id'].apply(lambda x: 1 if not pd.isna(x) else 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user