From 71c5d86679fcd2991af92243151031ce5a878524 Mon Sep 17 00:00:00 2001 From: arevelle-ensae Date: Thu, 22 Feb 2024 14:56:00 +0000 Subject: [PATCH] handle na for supplier --- 0_KPI_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0_KPI_functions.py b/0_KPI_functions.py index 5ba11b9..6d0fcbb 100644 --- a/0_KPI_functions.py +++ b/0_KPI_functions.py @@ -46,7 +46,7 @@ def tickets_kpi_function(tickets_information = None): # Dummy : Canal de vente en ligne liste_mots = ['en ligne', 'internet', 'web', 'net', 'vad', 'online'] # vad = vente à distance - tickets_information_copy['vente_internet'] = tickets_information_copy['supplier_name'].str.contains('|'.join(liste_mots), case=False).astype(int) + tickets_information_copy['vente_internet'] = tickets_information_copy['supplier_name'].fillna('').str.contains('|'.join(liste_mots), case=False).astype(int) # Proportion de vente en ligne prop_vente_internet = tickets_information_copy[tickets_information_copy['vente_internet'] == 1].groupby(['customer_id'])['ticket_id'].count().reset_index()