2024-02-10 19:37:38 +01:00
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "3f41343f-7205-41d9-89dd-88039e301413",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"# Statistiques descriptives"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"execution_count": 1,
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"id": "abfaf341-7b35-4407-9133-d21336c04027",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"import pandas as pd\n",
|
|
|
|
|
"import numpy as np\n",
|
|
|
|
|
"import os\n",
|
|
|
|
|
"import s3fs\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"import re\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
|
"import matplotlib.dates as mdates\n",
|
|
|
|
|
"from datetime import datetime, date, timedelta\n",
|
|
|
|
|
"from dateutil.relativedelta import relativedelta"
|
2024-02-10 19:37:38 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"execution_count": 2,
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"id": "7fb72fa3-7940-496f-ac78-c2837f65eefa",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"# Create filesystem object\n",
|
|
|
|
|
"S3_ENDPOINT_URL = \"https://\" + os.environ[\"AWS_S3_ENDPOINT\"]\n",
|
|
|
|
|
"fs = s3fs.S3FileSystem(client_kwargs={'endpoint_url': S3_ENDPOINT_URL})"
|
2024-02-10 19:37:38 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "45d5261f-4d46-49cb-8582-dd2121122b05",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"# 1 - Comportement d'achat"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "3479960c-0d23-45f1-8fff-d87395205731",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"## Outlier"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-10 19:37:38 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"execution_count": 3,
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"id": "9376af51-4320-44b6-8f30-1e1234371556",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Chargement des données temporaires\n",
|
|
|
|
|
"BUCKET = \"projet-bdc2324-team1\"\n",
|
|
|
|
|
"FILE_KEY_S3 = \"0_Temp/Company 1 - Purchasing behaviour.csv\"\n",
|
|
|
|
|
"FILE_PATH_S3 = BUCKET + \"/\" + FILE_KEY_S3\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"with fs.open(FILE_PATH_S3, mode=\"rb\") as file_in:\n",
|
|
|
|
|
" tickets_kpi = pd.read_csv(file_in, sep=\",\")"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"execution_count": 4,
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"id": "1855dcca-cfce-4c54-90ae-55d9a1ab5d45",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>customer_id</th>\n",
|
|
|
|
|
" <th>event_type_id</th>\n",
|
|
|
|
|
" <th>nb_tickets</th>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <th>nb_purchases</th>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <th>total_amount</th>\n",
|
|
|
|
|
" <th>nb_suppliers</th>\n",
|
|
|
|
|
" <th>vente_internet_max</th>\n",
|
|
|
|
|
" <th>purchase_date_min</th>\n",
|
|
|
|
|
" <th>purchase_date_max</th>\n",
|
|
|
|
|
" <th>time_between_purchase</th>\n",
|
|
|
|
|
" <th>nb_tickets_internet</th>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <th>name_event_types</th>\n",
|
|
|
|
|
" <th>avg_amount</th>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>384226</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>194790</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>2686540.5</td>\n",
|
|
|
|
|
" <td>7</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3262.190868</td>\n",
|
|
|
|
|
" <td>4.179306</td>\n",
|
|
|
|
|
" <td>3258.011562</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>51.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>453242</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>228945</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>3248965.5</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3698.198229</td>\n",
|
|
|
|
|
" <td>5.221840</td>\n",
|
|
|
|
|
" <td>3692.976389</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>2988.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>spectacle vivant</td>\n",
|
|
|
|
|
" <td>7.762474</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>201750</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>107110</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>1459190.0</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3803.369792</td>\n",
|
|
|
|
|
" <td>0.146331</td>\n",
|
|
|
|
|
" <td>3803.223461</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>9.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale groupe</td>\n",
|
|
|
|
|
" <td>4.452618</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>217356</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>111786</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>1435871.5</td>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2502.715509</td>\n",
|
|
|
|
|
" <td>1408.715532</td>\n",
|
|
|
|
|
" <td>1093.999977</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>5.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>143</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>143</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2041.274549</td>\n",
|
|
|
|
|
" <td>1340.308160</td>\n",
|
|
|
|
|
" <td>700.966389</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" customer_id event_type_id nb_tickets nb_purchases total_amount \\\n",
|
|
|
|
|
"0 1 2 384226 194790 2686540.5 \n",
|
|
|
|
|
"1 1 4 453242 228945 3248965.5 \n",
|
|
|
|
|
"2 1 5 201750 107110 1459190.0 \n",
|
|
|
|
|
"3 1 6 217356 111786 1435871.5 \n",
|
|
|
|
|
"4 2 2 143 143 0.0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" nb_suppliers vente_internet_max purchase_date_min purchase_date_max \\\n",
|
|
|
|
|
"0 7 1 3262.190868 4.179306 \n",
|
|
|
|
|
"1 6 1 3698.198229 5.221840 \n",
|
|
|
|
|
"2 6 1 3803.369792 0.146331 \n",
|
|
|
|
|
"3 5 1 2502.715509 1408.715532 \n",
|
|
|
|
|
"4 1 0 2041.274549 1340.308160 \n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" time_between_purchase nb_tickets_internet name_event_types \\\n",
|
|
|
|
|
"0 3258.011562 51.0 offre muséale individuel \n",
|
|
|
|
|
"1 3692.976389 2988.0 spectacle vivant \n",
|
|
|
|
|
"2 3803.223461 9.0 offre muséale groupe \n",
|
|
|
|
|
"3 1093.999977 5.0 formule adhésion \n",
|
|
|
|
|
"4 700.966389 0.0 offre muséale individuel \n",
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" avg_amount \n",
|
|
|
|
|
"0 6.150659 \n",
|
|
|
|
|
"1 7.762474 \n",
|
|
|
|
|
"2 4.452618 \n",
|
|
|
|
|
"3 6.439463 \n",
|
|
|
|
|
"4 6.150659 "
|
2024-02-10 19:37:38 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"execution_count": 4,
|
2024-02-10 19:37:38 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"tickets_kpi.head()"
|
|
|
|
|
]
|
2024-02-10 22:05:09 +01:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 5,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"id": "0e5d3b2e-1a75-4d46-80e6-c306e9f8de84",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"Index(['customer_id', 'event_type_id', 'nb_tickets', 'nb_purchases',\n",
|
|
|
|
|
" 'total_amount', 'nb_suppliers', 'vente_internet_max',\n",
|
|
|
|
|
" 'purchase_date_min', 'purchase_date_max', 'time_between_purchase',\n",
|
|
|
|
|
" 'nb_tickets_internet', 'name_event_types', 'avg_amount'],\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" dtype='object')"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 5,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"tickets_kpi.columns"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 6,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"id": "7667e8eb-9a1e-4216-96f4-bf987c6e30b5",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>customer_id</th>\n",
|
|
|
|
|
" <th>event_type_id</th>\n",
|
|
|
|
|
" <th>nb_tickets</th>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <th>nb_purchases</th>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <th>total_amount</th>\n",
|
|
|
|
|
" <th>nb_suppliers</th>\n",
|
|
|
|
|
" <th>vente_internet_max</th>\n",
|
|
|
|
|
" <th>purchase_date_min</th>\n",
|
|
|
|
|
" <th>purchase_date_max</th>\n",
|
|
|
|
|
" <th>time_between_purchase</th>\n",
|
|
|
|
|
" <th>nb_tickets_internet</th>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <th>name_event_types</th>\n",
|
|
|
|
|
" <th>avg_amount</th>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>453242</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>228945</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>3248965.5</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3698.198229</td>\n",
|
|
|
|
|
" <td>5.221840</td>\n",
|
|
|
|
|
" <td>3692.976389</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>2988.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>spectacle vivant</td>\n",
|
|
|
|
|
" <td>7.762474</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>384226</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>194790</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>2686540.5</td>\n",
|
|
|
|
|
" <td>7</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3262.190868</td>\n",
|
|
|
|
|
" <td>4.179306</td>\n",
|
|
|
|
|
" <td>3258.011562</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>51.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>217356</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>111786</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>1435871.5</td>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2502.715509</td>\n",
|
|
|
|
|
" <td>1408.715532</td>\n",
|
|
|
|
|
" <td>1093.999977</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>5.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>201750</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>107110</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>1459190.0</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3803.369792</td>\n",
|
|
|
|
|
" <td>0.146331</td>\n",
|
|
|
|
|
" <td>3803.223461</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>9.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale groupe</td>\n",
|
|
|
|
|
" <td>4.452618</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5032</th>\n",
|
|
|
|
|
" <td>6733</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>14208</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>114</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2492.187199</td>\n",
|
|
|
|
|
" <td>1442.405116</td>\n",
|
|
|
|
|
" <td>1049.782083</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>13497.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5029</th>\n",
|
|
|
|
|
" <td>6733</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>11656</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>158</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>471.0</td>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2982.237384</td>\n",
|
|
|
|
|
" <td>489.495324</td>\n",
|
|
|
|
|
" <td>2492.742060</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>9815.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5030</th>\n",
|
|
|
|
|
" <td>6733</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>7440</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>162</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>1036.392674</td>\n",
|
|
|
|
|
" <td>426.201944</td>\n",
|
|
|
|
|
" <td>610.190729</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>7419.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>spectacle vivant</td>\n",
|
|
|
|
|
" <td>7.762474</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>60</th>\n",
|
|
|
|
|
" <td>41</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>6583</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>634</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>12546.5</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>2501.337905</td>\n",
|
|
|
|
|
" <td>1409.370521</td>\n",
|
|
|
|
|
" <td>1091.967384</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>6391.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>57</th>\n",
|
|
|
|
|
" <td>41</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>6514</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>812</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>22423.0</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>3576.106609</td>\n",
|
|
|
|
|
" <td>247.232697</td>\n",
|
|
|
|
|
" <td>3328.873912</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>5321.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>36376</th>\n",
|
|
|
|
|
" <td>63488</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>5750</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>9</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>63250.0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>887.298484</td>\n",
|
|
|
|
|
" <td>440.265162</td>\n",
|
|
|
|
|
" <td>447.033322</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" <td>5750.0</td>\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" <td>spectacle vivant</td>\n",
|
|
|
|
|
" <td>7.762474</td>\n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" customer_id event_type_id nb_tickets nb_purchases total_amount \\\n",
|
|
|
|
|
"1 1 4 453242 228945 3248965.5 \n",
|
|
|
|
|
"0 1 2 384226 194790 2686540.5 \n",
|
|
|
|
|
"3 1 6 217356 111786 1435871.5 \n",
|
|
|
|
|
"2 1 5 201750 107110 1459190.0 \n",
|
|
|
|
|
"5032 6733 6 14208 114 0.0 \n",
|
|
|
|
|
"5029 6733 2 11656 158 471.0 \n",
|
|
|
|
|
"5030 6733 4 7440 162 0.0 \n",
|
|
|
|
|
"60 41 6 6583 634 12546.5 \n",
|
|
|
|
|
"57 41 2 6514 812 22423.0 \n",
|
|
|
|
|
"36376 63488 4 5750 9 63250.0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" nb_suppliers vente_internet_max purchase_date_min purchase_date_max \\\n",
|
|
|
|
|
"1 6 1 3698.198229 5.221840 \n",
|
|
|
|
|
"0 7 1 3262.190868 4.179306 \n",
|
|
|
|
|
"3 5 1 2502.715509 1408.715532 \n",
|
|
|
|
|
"2 6 1 3803.369792 0.146331 \n",
|
|
|
|
|
"5032 3 1 2492.187199 1442.405116 \n",
|
|
|
|
|
"5029 3 1 2982.237384 489.495324 \n",
|
|
|
|
|
"5030 2 1 1036.392674 426.201944 \n",
|
|
|
|
|
"60 4 1 2501.337905 1409.370521 \n",
|
|
|
|
|
"57 6 1 3576.106609 247.232697 \n",
|
|
|
|
|
"36376 1 1 887.298484 440.265162 \n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" time_between_purchase nb_tickets_internet name_event_types \\\n",
|
|
|
|
|
"1 3692.976389 2988.0 spectacle vivant \n",
|
|
|
|
|
"0 3258.011562 51.0 offre muséale individuel \n",
|
|
|
|
|
"3 1093.999977 5.0 formule adhésion \n",
|
|
|
|
|
"2 3803.223461 9.0 offre muséale groupe \n",
|
|
|
|
|
"5032 1049.782083 13497.0 formule adhésion \n",
|
|
|
|
|
"5029 2492.742060 9815.0 offre muséale individuel \n",
|
|
|
|
|
"5030 610.190729 7419.0 spectacle vivant \n",
|
|
|
|
|
"60 1091.967384 6391.0 formule adhésion \n",
|
|
|
|
|
"57 3328.873912 5321.0 offre muséale individuel \n",
|
|
|
|
|
"36376 447.033322 5750.0 spectacle vivant \n",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
" avg_amount \n",
|
|
|
|
|
"1 7.762474 \n",
|
|
|
|
|
"0 6.150659 \n",
|
|
|
|
|
"3 6.439463 \n",
|
|
|
|
|
"2 4.452618 \n",
|
|
|
|
|
"5032 6.439463 \n",
|
|
|
|
|
"5029 6.150659 \n",
|
|
|
|
|
"5030 7.762474 \n",
|
|
|
|
|
"60 6.439463 \n",
|
|
|
|
|
"57 6.150659 \n",
|
|
|
|
|
"36376 7.762474 "
|
2024-02-10 22:05:09 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 6,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Présence d'outlier\n",
|
|
|
|
|
"tickets_kpi.sort_values(by = ['nb_tickets'], axis = 0, ascending = False).head(10)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 7,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"id": "9b2e27f2-703d-465b-a0f9-76e996de617c",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Part du CA par customer\n",
|
|
|
|
|
"total_amount_share = tickets_kpi.groupby('customer_id')['total_amount'].sum().reset_index()\n",
|
|
|
|
|
"total_amount_share['total_amount_entreprise'] = total_amount_share['total_amount'].sum()\n",
|
|
|
|
|
"total_amount_share['share_total_amount'] = total_amount_share['total_amount']/total_amount_share['total_amount_entreprise']\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"total_amount_share_index = total_amount_share.set_index('customer_id')\n",
|
|
|
|
|
"df_circulaire = total_amount_share_index['total_amount'].sort_values(axis = 0, ascending = False)\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 8,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"id": "36141803-8865-4210-bd39-0a980301fd0c",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAASMAAAEWCAYAAAAtl/EzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA3MElEQVR4nO3dd3hTZfsH8G9WkzbdpXtSRpllgyCIRZFVEARUZBVQprhFRFkKIv4c+IIvLhRRUMSBIoJFlsree7RQWlZp6V5pM+7fH30bSQddSc85yf25rl6Q5OSc+5ycfHPm88iIiMAYYwKTC10AY4wBHEaMMZHgMGKMiQKHEWNMFDiMGGOiwGHEGBMFDiPGmChwGDHGRIHDiDEmCg0WRidPnoSLiwuWL1/eUJNkjElIrcJo9erVkMlk5j+lUonAwEA8/vjjSEhIqPJ9eXl5GDFiBGbOnImZM2fWu+j6+P3337FgwYJKX4uIiEBcXJz58Y0bN7BgwQIcP368wrALFiyATCazTZF1JJPJqpw3R3H27FksWLAAV65caZDpvfXWW9i4caPVxmeN+u+2josa1cKXX35JAOjLL7+kffv20c6dO2nRokXk7OxMfn5+lJmZWen7Ro4cSaNHjyaTyVSbydnEjBkzqKrZPnr0KCUmJpofHzp0yDy/5V29epX27dtnqzLrBADNnz9f6DIEtWHDBgJAO3fubJDpabVaGj9+vNXGZ43677aO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XLgQt27dMm8lDR48GOfPn6/1+O5cv8qr6fq1ceNGFBQU4KeffjJ
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 300x300 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Costumer 1 vs others customers\n",
|
|
|
|
|
"coupure = 1\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"top = df_circulaire[:coupure]\n",
|
|
|
|
|
"rest = df_circulaire[coupure:]\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Calculez la somme du reste\n",
|
|
|
|
|
"rest_sum = rest.sum()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Créez une nouvelle série avec les cinq plus grandes parts et 'Autre'\n",
|
|
|
|
|
"new_series = pd.concat([top, pd.Series([rest_sum], index=['Autre'])])\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Créez le graphique circulaire\n",
|
|
|
|
|
"plt.figure(figsize=(3, 3))\n",
|
|
|
|
|
"plt.pie(new_series, labels=new_series.index, autopct='%1.1f%%', startangle=140, pctdistance=0.5)\n",
|
|
|
|
|
"plt.axis('equal') # Assurez-vous que le graphique est un cercle\n",
|
|
|
|
|
"plt.title('Répartition des montants totaux')\n",
|
|
|
|
|
"plt.show()\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-10 23:19:35 +01:00
|
|
|
|
"execution_count": 9,
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"id": "94cf1a25-9ded-48f2-b1b2-75225bdaf49d",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"tickets_kpi_filtered = tickets_kpi[tickets_kpi['customer_id'] != 1]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "dbebfa92-310a-417b-a7fa-36ac3593db06",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"## Evolution des commandes"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 18:45:33 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 10,
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"id": "06137694-7f50-47ba-8749-68471ececc1e",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Importation - Chargement des données temporaires\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Achat\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"BUCKET = \"projet-bdc2324-team1\"\n",
|
|
|
|
|
"FILE_KEY_S3 = \"0_Temp/Company 1 - Purchases.csv\"\n",
|
|
|
|
|
"FILE_PATH_S3 = BUCKET + \"/\" + FILE_KEY_S3\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"with fs.open(FILE_PATH_S3, mode=\"rb\") as file_in:\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" purchases = pd.read_csv(file_in, sep=\",\")\n",
|
|
|
|
|
" \n",
|
|
|
|
|
"purchases['purchase_date'] = pd.to_datetime(purchases['purchase_date'], utc = True, format = 'ISO8601')\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Emails\n",
|
|
|
|
|
"BUCKET = \"projet-bdc2324-team1\"\n",
|
|
|
|
|
"FILE_KEY_S3 = \"0_Temp/Company 1 - Campaigns dataset clean.csv\"\n",
|
|
|
|
|
"FILE_PATH_S3 = BUCKET + \"/\" + FILE_KEY_S3\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"with fs.open(FILE_PATH_S3, mode=\"rb\") as file_in:\n",
|
|
|
|
|
" campaigns = pd.read_csv(file_in, sep=\",\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"campaigns['sent_at'] = pd.to_datetime(campaigns['sent_at'], utc = True, format = 'ISO8601')\n"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 11,
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"id": "e6b962d4-1a30-4133-ac0f-359f7afef42c",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"metadata": {},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"outputs": [],
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Mois du premier achat\n",
|
|
|
|
|
"purchase_min = purchases.groupby(['customer_id', 'event_type_id'])['purchase_date'].min().reset_index()\n",
|
|
|
|
|
"purchase_min.rename(columns = {'purchase_date' : 'first_purchase_event'}, inplace = True)\n",
|
|
|
|
|
"purchase_min['first_purchase_event'] = pd.to_datetime(purchase_min['first_purchase_event'])\n",
|
|
|
|
|
"purchase_min['first_purchase_month'] = pd.to_datetime(purchase_min['first_purchase_event'].dt.strftime('%Y-%m'))\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Mois du premier mails\n",
|
|
|
|
|
"first_mail_received = campaigns.groupby('customer_id')['sent_at'].min().reset_index()\n",
|
|
|
|
|
"first_mail_received.rename(columns = {'sent_at' : 'first_email_reception'}, inplace = True)\n",
|
|
|
|
|
"first_mail_received['first_email_reception'] = pd.to_datetime(first_mail_received['first_email_reception'])\n",
|
|
|
|
|
"first_mail_received['first_email_month'] = pd.to_datetime(first_mail_received['first_email_reception'].dt.strftime('%Y-%m'))\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Fusion \n",
|
|
|
|
|
"known_customer = pd.merge(purchase_min[['customer_id', 'event_type_id', 'first_purchase_month']], \n",
|
|
|
|
|
" first_mail_received[['customer_id', 'first_email_month']], on = 'customer_id', how = 'outer')\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Mois à partir duquel le client est considere comme connu\n",
|
|
|
|
|
"known_customer['known_date'] = pd.to_datetime(known_customer[['first_email_month', 'first_purchase_month']].min(axis = 1), utc = True, format = 'ISO8601')"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 12,
|
|
|
|
|
"id": "9c56e5ac-cbf4-4343-80ba-be2ab8b60eab",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Nombre de commande par mois\n",
|
|
|
|
|
"purchases_count = pd.merge(purchases[['customer_id', 'event_type_id', 'purchase_id', 'purchase_date']].drop_duplicates(), known_customer[['customer_id', 'event_type_id', 'known_date']], on = ['customer_id', 'event_type_id'], how = 'inner')\n",
|
|
|
|
|
"purchases_count['is_customer_known'] = purchases_count['purchase_date'] > purchases_count['known_date'] + pd.DateOffset(months=1)\n",
|
|
|
|
|
"purchases_count['purchase_date_month'] = pd.to_datetime(purchases_count['purchase_date'].dt.strftime('%Y-%m'))\n",
|
|
|
|
|
"purchases_count = purchases_count[purchases_count['customer_id'] != 1]\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Nombre de commande par mois par type de client\n",
|
|
|
|
|
"nb_purchases_graph = purchases_count.groupby(['purchase_date_month', 'event_type_id', 'is_customer_known'])['purchase_id'].count().reset_index()\n",
|
|
|
|
|
"nb_purchases_graph.rename(columns = {'purchase_id' : 'nb_purchases'}, inplace = True)\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"nb_purchases_graph_2 = purchases_count.groupby(['purchase_date_month', 'event_type_id', 'is_customer_known'])['customer_id'].nunique().reset_index()\n",
|
|
|
|
|
"nb_purchases_graph_2.rename(columns = {'customer_id' : 'nb_new_customer'}, inplace = True)"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 13,
|
|
|
|
|
"id": "8c1aed44-03d3-49f9-b96c-b06a0df03dde",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnsAAAHGCAYAAAAMiE2hAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABsp0lEQVR4nO3deXxM1/8/8NdkXyQj+wgjSa0piZ2GkoREqNjblBBrUYrGUpWqCi0qLaLRUmpXy6e1FCUVu4glQqyxx1aJKBFbZD2/P/xyvyaTPZPFeD0fj3kw5565933mLvPOuffcKxNCCBARERGRVtKp6ACIiIiIqOww2SMiIiLSYkz2iIiIiLQYkz0iIiIiLcZkj4iIiEiLMdkjIiIi0mJM9oiIiIi0GJM9IiIiIi3GZI+IiIhIizHZI6K3xpIlS2Bqaorjx49XdChEb6yzZ8/CxMQEYWFhFR0KFVGZJHsrV66ETCaDkZERbt26pTbdw8MDDRs2LItFF2rQoEGoUqVKhSy7MDKZDMHBwdL7nO+xrAQHB0Mmk+G///7T2DzXrVuH0NBQjc2PNCdnfWtKzvZ58+ZNqWzQoEHw8PDQ2DI0KTY2FuPHj8eGD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UNMTEyxjrnZ2dkICQlB/fr1YWhoCFtbWwwYMEBlH87rO8yRe7vPOeW6du1ajB8/HgqFAsbGxnB3d9foMahIRBlYsWKFACCio6PFggULBACxd+9eabq7u7to0KCB9D47O1v4+PgIPT09MXXqVLF7927x448/ClNTU9GkSRPx8uVLqa6Dg4OoUaOGaNiwoVi/fr3YuXOnaNWqldDX1xfffPONaNOmjdi8ebPYsmWLqFu3rrCzsxMvXryQPj9w4EBhYGAgatasKWbOnCl2794tgoODhZ6envD19VVpBwBRvXp14erqKtatWyf27dsnzp8/Ly5cuCDkcrlwcXERq1evFrt37xYTJkwQOjo6Ijg4uMDvJjs7W3h6egpDQ0Np+dOmTRPvvPOOACCmTZtW4Oe//fZbMX/+fPH333+LAwcOiMWLFwsnJyfh6empUi88PFzo6+sLV1dXsXLlSrFv3z6xfPly0adPH6nOtGnTBABRr1498c0334iIiAgxb948YWhoKAYPHqwyv3HjxolFixaJ8PBwsW/fPjF//nxhbW2tUu/ChQuiTZs2QqFQiKNHj0ovIYRYv369ACDGjBkjdu/eLfbs2SMWL14sxo4dW2B7hRBi0KBBYtmyZSIiIkJERESIb7/9VhgbG4vp06er1Mvv+3NwcBADBw4scBkZGRnC09NT6OnpiYkTJ4qdO3eKbdu2ia+++kqsX79eCFG87bSoseTsK9WrVxfDhw8Xu3btEn/++afIzMwUPj4+wsbGRixZskQcOHBAbN26VXzzzTdiw4YNBbZlz549QldXV7z//vti8+bN4o8//hAtWrQQNWvWFLl3+WHDhgl9fX0xYcIEER4eLtatWyfq168v7OzsRGJiYoHLyYk9Pj6+wHpFXX85+/a7774rVq9eLf755x/x0UcfCQDi4MGDast95513xJgxY8Q///wjfvvtN2FhYaG2H8ycOVPIZDIxZMgQsWPHDrF582bh5uYmTE1NxYULF6R6+/btEwYGBqJt27Zi48aNIjw8XAwaNEgAECtWrCiwffkZOHCg0NPTE//9959U9t5774kWLVqo1T1//rwAIH799dcC55nT9r/++kttWnZ2tsjIyBApKSli165dQqFQiL59+xYaZ848lUqlGDJkiNi1a5dYsmSJsLW1FUqlUiQnJ0t1Z82aJQCIvn37ir///lusXr1avPPOO0Iul4srV65I9dzd3YW7u3ue34mDg4P0Pj4+Xtr+PT09xZ9//il2795d4DZVlP35999/FwBEx44
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"text/plain": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"output_type": "display_data"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Graphique en nombre de commande\n",
|
|
|
|
|
"event_type = 5\n",
|
|
|
|
|
"purchases_graph = nb_purchases_graph[nb_purchases_graph['event_type_id'] == event_type]\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"purchases_graph_used = purchases_graph[purchases_graph[\"purchase_date_month\"] >= datetime(2022,1,1)]\n",
|
|
|
|
|
"purchases_graph_used_0 = purchases_graph_used[purchases_graph_used[\"is_customer_known\"]==False]\n",
|
|
|
|
|
"purchases_graph_used_1 = purchases_graph_used[purchases_graph_used[\"is_customer_known\"]==True]\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Création du barplot\n",
|
|
|
|
|
"plt.bar(purchases_graph_used_0[\"purchase_date_month\"], purchases_graph_used_0[\"nb_purchases\"], width=12, label = \"Nouveau client\")\n",
|
|
|
|
|
"plt.bar(purchases_graph_used_0[\"purchase_date_month\"], purchases_graph_used_1[\"nb_purchases\"], \n",
|
|
|
|
|
" bottom = purchases_graph_used_0[\"nb_purchases\"], width=12, label = \"Ancien client\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# commande pr afficher slt\n",
|
|
|
|
|
"plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%y'))\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Ajout de titres et d'étiquettes\n",
|
|
|
|
|
"plt.xlabel('Mois')\n",
|
|
|
|
|
"plt.ylabel(\"Nombre d'achats\")\n",
|
|
|
|
|
"plt.title(\"Nombre d'achats au cours de l'année 2023 pour l'offre 'muséale groupe'\")\n",
|
|
|
|
|
"plt.legend()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Affichage du barplot\n",
|
|
|
|
|
"plt.show()"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 14,
|
|
|
|
|
"id": "d312276c-4c46-4d29-b6d6-ed110f59890d",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoIAAAHGCAYAAADg0eryAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABt9UlEQVR4nO3dd1gU1/s28Huld+lFV0DBEgW7Roki9oI9sSvYY40RoxKjYo/GGowaExXUoMavJbbYFaNYAHsvwQ5BBUERqef9w5f5uTRZ2AV078917XWxZ87OPGfK7sOZOTMyIYQAEREREWmcMiUdABERERGVDCaCRERERBqKiSARERGRhmIiSERERKShmAgSERERaSgmgkREREQaiokgERERkYZiIkhERESkoZgIEhEREWkoJoJE9NH6/vvvYWtri3v37pV0KET0/x04cAA6OjrYuXNnSYdCBVCkRDAoKAgymQz6+vp48OBBjunNmjVDjRo1irKIQvP19YWxsXGJLPtDZDIZAgICinW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elGxYkVhZmYmbt++LYR49738ww8/SOvv9OnT4u7du+L8+fNi8ODBAoDYv3+/wvZ1dHQU9vb2omLFimLt2rXi2LFj4ty5cwX+bi2orPXi6OgofH19pXVtbGwsvLy8RKtWrcSECRPEwYMHxfz584WWlpYYM2aM9Pms7/Cs/SK/9demTRthbW0tVq9eLY4fPy527twppk2bJjZv3izV2bBhg5DJZKJLly5i+/btYvfu3cLb21toaWm
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"text/plain": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# graphique en nombre de client ayant commandé\n",
|
|
|
|
|
"event_type = 5\n",
|
|
|
|
|
"purchases_graph = nb_purchases_graph_2[nb_purchases_graph_2['event_type_id'] == event_type]\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"purchases_graph_used = purchases_graph[purchases_graph[\"purchase_date_month\"] >= datetime(2022,1,1)]\n",
|
|
|
|
|
"purchases_graph_used_0 = purchases_graph_used[purchases_graph_used[\"is_customer_known\"]==False]\n",
|
|
|
|
|
"purchases_graph_used_1 = purchases_graph_used[purchases_graph_used[\"is_customer_known\"]==True]\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Création du barplot\n",
|
|
|
|
|
"plt.bar(purchases_graph_used_0[\"purchase_date_month\"], purchases_graph_used_0[\"nb_new_customer\"], width=12, label = \"Nouveau client\")\n",
|
|
|
|
|
"plt.bar(purchases_graph_used_0[\"purchase_date_month\"], purchases_graph_used_1[\"nb_new_customer\"], \n",
|
|
|
|
|
" bottom = purchases_graph_used_0[\"nb_new_customer\"], width=12, label = \"Ancien client\")\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# commande pr afficher slt\n",
|
|
|
|
|
"plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%y'))\n",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"\n",
|
|
|
|
|
"# Ajout de titres et d'étiquettes\n",
|
|
|
|
|
"plt.xlabel('Mois')\n",
|
|
|
|
|
"plt.ylabel(\"Nombre de client ayant commandé\")\n",
|
|
|
|
|
"plt.title(\"Nombre de client ayant commandé un ticket pour l'offre 'muséale groupe'\")\n",
|
|
|
|
|
"plt.legend()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Affichage du barplot\n",
|
|
|
|
|
"plt.show()"
|
2024-02-13 18:45:33 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-11 11:47:58 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "b8a90eaa-c383-4f73-9fd6-6fbbe8eeefb8",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"# 2 - Comportement d'achat bis (Alexis)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 15,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "dc45c1cd-2a78-48a6-aa2b-6a501254b6f2",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"(156289, 40)\n"
|
2024-02-11 11:47:58 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>customer_id</th>\n",
|
|
|
|
|
" <th>birthdate</th>\n",
|
|
|
|
|
" <th>street_id</th>\n",
|
|
|
|
|
" <th>is_partner</th>\n",
|
|
|
|
|
" <th>gender</th>\n",
|
|
|
|
|
" <th>is_email_true</th>\n",
|
|
|
|
|
" <th>opt_in</th>\n",
|
|
|
|
|
" <th>structure_id</th>\n",
|
|
|
|
|
" <th>profession</th>\n",
|
|
|
|
|
" <th>language</th>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <th>vente_internet_max</th>\n",
|
|
|
|
|
" <th>purchase_date_min</th>\n",
|
|
|
|
|
" <th>purchase_date_max</th>\n",
|
|
|
|
|
" <th>time_between_purchase</th>\n",
|
|
|
|
|
" <th>nb_tickets_internet</th>\n",
|
|
|
|
|
" <th>name_event_types</th>\n",
|
|
|
|
|
" <th>avg_amount</th>\n",
|
|
|
|
|
" <th>nb_campaigns</th>\n",
|
|
|
|
|
" <th>nb_campaigns_opened</th>\n",
|
|
|
|
|
" <th>time_to_open</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>1.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>3262.190868</td>\n",
|
|
|
|
|
" <td>4.179306</td>\n",
|
|
|
|
|
" <td>3258.011562</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>51.0</td>\n",
|
|
|
|
|
" <td>offre muséale individuel</td>\n",
|
|
|
|
|
" <td>6.150659</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>1.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>2502.715509</td>\n",
|
|
|
|
|
" <td>1408.715532</td>\n",
|
|
|
|
|
" <td>1093.999977</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>5.0</td>\n",
|
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>1.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>3698.198229</td>\n",
|
|
|
|
|
" <td>5.221840</td>\n",
|
|
|
|
|
" <td>3692.976389</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>2988.0</td>\n",
|
|
|
|
|
" <td>spectacle vivant</td>\n",
|
|
|
|
|
" <td>7.762474</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>1.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>3803.369792</td>\n",
|
|
|
|
|
" <td>0.146331</td>\n",
|
|
|
|
|
" <td>3803.223461</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>9.0</td>\n",
|
|
|
|
|
" <td>offre muséale groupe</td>\n",
|
|
|
|
|
" <td>4.452618</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>False</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>True</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>1705.261192</td>\n",
|
|
|
|
|
" <td>1456.333715</td>\n",
|
|
|
|
|
" <td>248.927477</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>formule adhésion</td>\n",
|
|
|
|
|
" <td>6.439463</td>\n",
|
|
|
|
|
" <td>4.0</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>NaN</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>NaN</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"<p>5 rows × 40 columns</p>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" customer_id birthdate street_id is_partner gender is_email_true \\\n",
|
|
|
|
|
"0 1 NaN 2 False 2 True \n",
|
|
|
|
|
"1 1 NaN 2 False 2 True \n",
|
|
|
|
|
"2 1 NaN 2 False 2 True \n",
|
|
|
|
|
"3 1 NaN 2 False 2 True \n",
|
|
|
|
|
"4 2 NaN 2 False 1 True \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" opt_in structure_id profession language ... vente_internet_max \\\n",
|
|
|
|
|
"0 False NaN NaN NaN ... 1.0 \n",
|
|
|
|
|
"1 False NaN NaN NaN ... 1.0 \n",
|
|
|
|
|
"2 False NaN NaN NaN ... 1.0 \n",
|
|
|
|
|
"3 False NaN NaN NaN ... 1.0 \n",
|
|
|
|
|
"4 True NaN NaN NaN ... 0.0 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" purchase_date_min purchase_date_max time_between_purchase \\\n",
|
|
|
|
|
"0 3262.190868 4.179306 3258.011562 \n",
|
|
|
|
|
"1 2502.715509 1408.715532 1093.999977 \n",
|
|
|
|
|
"2 3698.198229 5.221840 3692.976389 \n",
|
|
|
|
|
"3 3803.369792 0.146331 3803.223461 \n",
|
|
|
|
|
"4 1705.261192 1456.333715 248.927477 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" nb_tickets_internet name_event_types avg_amount nb_campaigns \\\n",
|
|
|
|
|
"0 51.0 offre muséale individuel 6.150659 NaN \n",
|
|
|
|
|
"1 5.0 formule adhésion 6.439463 NaN \n",
|
|
|
|
|
"2 2988.0 spectacle vivant 7.762474 NaN \n",
|
|
|
|
|
"3 9.0 offre muséale groupe 4.452618 NaN \n",
|
|
|
|
|
"4 0.0 formule adhésion 6.439463 4.0 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" nb_campaigns_opened time_to_open \n",
|
|
|
|
|
"0 NaN NaN \n",
|
|
|
|
|
"1 NaN NaN \n",
|
|
|
|
|
"2 NaN NaN \n",
|
|
|
|
|
"3 NaN NaN \n",
|
|
|
|
|
"4 NaN NaN \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"[5 rows x 40 columns]"
|
2024-02-11 11:47:58 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 15,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Chargement des données temporaires\n",
|
|
|
|
|
"BUCKET = \"projet-bdc2324-team1\"\n",
|
|
|
|
|
"FILE_KEY_S3 = \"0_Temp/Company 1 - customer_event.csv\"\n",
|
|
|
|
|
"FILE_PATH_S3 = BUCKET + \"/\" + FILE_KEY_S3\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"with fs.open(FILE_PATH_S3, mode=\"rb\") as file_in:\n",
|
|
|
|
|
" customer = pd.read_csv(file_in, sep=\",\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"print(customer.shape)\n",
|
|
|
|
|
"customer.head()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 16,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "89fcb455-efb4-4ad4-ab88-efd6c8a76287",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"Index(['customer_id', 'birthdate', 'street_id', 'is_partner', 'gender',\n",
|
|
|
|
|
" 'is_email_true', 'opt_in', 'structure_id', 'profession', 'language',\n",
|
|
|
|
|
" 'mcp_contact_id', 'last_buying_date', 'max_price', 'ticket_sum',\n",
|
|
|
|
|
" 'average_price', 'fidelity', 'average_purchase_delay',\n",
|
|
|
|
|
" 'average_price_basket', 'average_ticket_basket', 'total_price',\n",
|
|
|
|
|
" 'purchase_count', 'first_buying_date', 'country', 'age', 'tenant_id',\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" 'event_type_id', 'nb_tickets', 'nb_purchases', 'total_amount',\n",
|
|
|
|
|
" 'nb_suppliers', 'vente_internet_max', 'purchase_date_min',\n",
|
|
|
|
|
" 'purchase_date_max', 'time_between_purchase', 'nb_tickets_internet',\n",
|
|
|
|
|
" 'name_event_types', 'avg_amount', 'nb_campaigns', 'nb_campaigns_opened',\n",
|
|
|
|
|
" 'time_to_open'],\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" dtype='object')"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 16,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"customer.columns"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 17,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "d7b2356a-d5fc-4547-b3ff-fded0e304fb6",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>customer_id</th>\n",
|
|
|
|
|
" <th>average_price</th>\n",
|
|
|
|
|
" <th>average_purchase_delay</th>\n",
|
|
|
|
|
" <th>average_price_basket</th>\n",
|
|
|
|
|
" <th>average_ticket_basket</th>\n",
|
|
|
|
|
" <th>purchase_count</th>\n",
|
|
|
|
|
" <th>total_price</th>\n",
|
|
|
|
|
" <th>nb_campaigns</th>\n",
|
|
|
|
|
" <th>nb_campaigns_opened</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>7.030122</td>\n",
|
|
|
|
|
" <td>-67.790969</td>\n",
|
|
|
|
|
" <td>13.751530</td>\n",
|
|
|
|
|
" <td>1.956087</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>641472</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>8821221.5</td>\n",
|
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>1.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>307</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" <td>4.0</td>\n",
|
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>6</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>18.333333</td>\n",
|
|
|
|
|
" <td>30.666667</td>\n",
|
|
|
|
|
" <td>36.666667</td>\n",
|
|
|
|
|
" <td>2.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>3</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>110.0</td>\n",
|
|
|
|
|
" <td>222.0</td>\n",
|
|
|
|
|
" <td>124.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>7</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>10.250000</td>\n",
|
|
|
|
|
" <td>5.000000</td>\n",
|
|
|
|
|
" <td>20.500000</td>\n",
|
|
|
|
|
" <td>2.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>2</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>41.0</td>\n",
|
|
|
|
|
" <td>7.0</td>\n",
|
|
|
|
|
" <td>7.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>9</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>9.500000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>19.000000</td>\n",
|
|
|
|
|
" <td>2.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>1</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>19.0</td>\n",
|
|
|
|
|
" <td>4.0</td>\n",
|
|
|
|
|
" <td>0.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" customer_id average_price average_purchase_delay average_price_basket \\\n",
|
|
|
|
|
"0 1 7.030122 -67.790969 13.751530 \n",
|
|
|
|
|
"4 2 0.000000 0.000000 0.000000 \n",
|
|
|
|
|
"6 3 18.333333 30.666667 36.666667 \n",
|
|
|
|
|
"7 4 10.250000 5.000000 20.500000 \n",
|
|
|
|
|
"9 5 9.500000 0.000000 19.000000 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" average_ticket_basket purchase_count total_price nb_campaigns \\\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"0 1.956087 641472 8821221.5 0.0 \n",
|
|
|
|
|
"4 1.000000 307 0.0 4.0 \n",
|
|
|
|
|
"6 2.000000 3 110.0 222.0 \n",
|
|
|
|
|
"7 2.000000 2 41.0 7.0 \n",
|
|
|
|
|
"9 2.000000 1 19.0 4.0 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
|
|
|
|
" nb_campaigns_opened \n",
|
|
|
|
|
"0 0.0 \n",
|
|
|
|
|
"4 0.0 \n",
|
|
|
|
|
"6 124.0 \n",
|
|
|
|
|
"7 7.0 \n",
|
|
|
|
|
"9 0.0 "
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 17,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"achat = ['customer_id', 'average_price', 'average_purchase_delay', 'average_price_basket',\n",
|
|
|
|
|
" 'average_ticket_basket', 'purchase_count', 'total_price', 'nb_campaigns',\n",
|
|
|
|
|
" 'nb_campaigns_opened']\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"customer_achat = customer[achat].drop_duplicates(subset = ['customer_id'])\n",
|
|
|
|
|
"customer_achat['nb_campaigns'] = customer_achat['nb_campaigns'].fillna(0)\n",
|
|
|
|
|
"customer_achat['nb_campaigns_opened'] = customer_achat['nb_campaigns_opened'].fillna(0)\n",
|
|
|
|
|
"customer_achat = customer_achat.fillna(0)\n",
|
|
|
|
|
"customer_achat.head()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 18,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "5559748f-1745-4651-a9f6-94702c7ee66f",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>average_price</th>\n",
|
|
|
|
|
" <th>average_purchase_delay</th>\n",
|
|
|
|
|
" <th>average_price_basket</th>\n",
|
|
|
|
|
" <th>average_ticket_basket</th>\n",
|
|
|
|
|
" <th>purchase_count</th>\n",
|
|
|
|
|
" <th>total_price</th>\n",
|
|
|
|
|
" <th>nb_campaigns</th>\n",
|
|
|
|
|
" <th>nb_campaigns_opened</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>count</th>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
|
|
|
|
" <td>151865.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>mean</th>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>5.252070</td>\n",
|
|
|
|
|
" <td>-206.581486</td>\n",
|
|
|
|
|
" <td>11.451596</td>\n",
|
|
|
|
|
" <td>1.723372</td>\n",
|
|
|
|
|
" <td>0.655148</td>\n",
|
|
|
|
|
" <td>16.994064</td>\n",
|
|
|
|
|
" <td>40.923241</td>\n",
|
|
|
|
|
" <td>7.870681</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>std</th>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>7.915955</td>\n",
|
|
|
|
|
" <td>2996.743657</td>\n",
|
|
|
|
|
" <td>48.271194</td>\n",
|
|
|
|
|
" <td>7.045950</td>\n",
|
|
|
|
|
" <td>5.694038</td>\n",
|
|
|
|
|
" <td>313.099102</td>\n",
|
|
|
|
|
" <td>70.445724</td>\n",
|
|
|
|
|
" <td>23.119061</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>min</th>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>-44863.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>25%</th>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>2.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>50%</th>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>5.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>1.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>75%</th>\n",
|
|
|
|
|
" <td>11.000000</td>\n",
|
|
|
|
|
" <td>0.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>19.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>2.000000</td>\n",
|
|
|
|
|
" <td>1.000000</td>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>20.000000</td>\n",
|
|
|
|
|
" <td>32.000000</td>\n",
|
|
|
|
|
" <td>3.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>max</th>\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" <td>320.000000</td>\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" <td>1914.000000</td>\n",
|
|
|
|
|
" <td>9900.000000</td>\n",
|
|
|
|
|
" <td>900.000000</td>\n",
|
|
|
|
|
" <td>1508.000000</td>\n",
|
|
|
|
|
" <td>64350.000000</td>\n",
|
|
|
|
|
" <td>439.000000</td>\n",
|
|
|
|
|
" <td>434.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" average_price average_purchase_delay average_price_basket \\\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"count 151865.000000 151865.000000 151865.000000 \n",
|
|
|
|
|
"mean 5.252070 -206.581486 11.451596 \n",
|
|
|
|
|
"std 7.915955 2996.743657 48.271194 \n",
|
|
|
|
|
"min 0.000000 -44863.000000 0.000000 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"25% 0.000000 0.000000 0.000000 \n",
|
|
|
|
|
"50% 0.000000 0.000000 0.000000 \n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"75% 11.000000 0.000000 19.000000 \n",
|
|
|
|
|
"max 320.000000 1914.000000 9900.000000 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"\n",
|
|
|
|
|
" average_ticket_basket purchase_count total_price nb_campaigns \\\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"count 151865.000000 151865.000000 151865.000000 151865.000000 \n",
|
|
|
|
|
"mean 1.723372 0.655148 16.994064 40.923241 \n",
|
|
|
|
|
"std 7.045950 5.694038 313.099102 70.445724 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"min 0.000000 0.000000 0.000000 0.000000 \n",
|
|
|
|
|
"25% 0.000000 0.000000 0.000000 2.000000 \n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"50% 0.000000 0.000000 0.000000 5.000000 \n",
|
|
|
|
|
"75% 2.000000 1.000000 20.000000 32.000000 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"max 900.000000 1508.000000 64350.000000 439.000000 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" nb_campaigns_opened \n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"count 151865.000000 \n",
|
|
|
|
|
"mean 7.870681 \n",
|
|
|
|
|
"std 23.119061 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"min 0.000000 \n",
|
|
|
|
|
"25% 0.000000 \n",
|
|
|
|
|
"50% 1.000000 \n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"75% 3.000000 \n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"max 434.000000 "
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 18,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"customer_wto_outlier = customer_achat[customer_achat['customer_id']!=1]\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"customer_wto_outlier[['average_price', 'average_purchase_delay', 'average_price_basket',\n",
|
|
|
|
|
" 'average_ticket_basket', 'purchase_count', 'total_price', 'nb_campaigns', 'nb_campaigns_opened']].describe()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "b49c9e93-f324-42ee-a262-34ffb44a2261",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"# Event"
|
2024-02-11 11:47:58 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 19,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "4971e35d-a762-4e18-9443-fd9571bd3f1e",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAJgCAYAAACXyFewAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAACRpklEQVR4nOzdeXxM1/8/8NdkXyQjkZ2IRAiRxFqRqJ2EirVKG9LYtUpqSa211lZ76aeWqtrXompLY6/YhSRUKBUEiSAbQURyfn/45X6NCZ1h4o54PR+PeTzMuWfuvGZJvHPuuecqhBACRERERPRKBnIHICIiInoXsGgiIiIi0gCLJiIiIiINsGgiIiIi0gCLJiIiIiINsGgiIiIi0gCLJiIiIiINsGgiIiIi0gCLJiIiIiINsGgiIiLSUwkJCbCwsMD8+fPfaB9KpfKN9kHPsGgqJsuWLYNCoYCZmRmuXbumtr1x48bw8fGRIRnQvXt3lCpVSpbn/i8KhQLjx4+XOwa9hp07d/Kze8GBAwegUChw4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AxMTFSGwChVCpFenq6St/g4GBRrlw5tS/bgAEDhJmZmVr/5+3ateuVz/980fQmz/PXX38JAGq/TJ+XmJgoAIj+/furtB8/flwAEKNGjZLaGjVqJACI48ePq/T19vYWwcHB0v2QkBBRo0aNlz6nEELUq1dPODg4iPv370ttT58+FT4+PqJcuXLS96TwezRw4ECVx7dv314AELNnz1Zpr1GjhqhVq5Z0v/A
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Nombre de consommateurs uniques par type d'évènement\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"event_counts = customer.groupby('name_event_types')['customer_id'].nunique()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"event_counts.plot(kind='bar')\n",
|
|
|
|
|
"plt.xlabel(\"Type d'évènement\")\n",
|
|
|
|
|
"plt.ylabel('Nombre de consommateurs uniques')\n",
|
|
|
|
|
"plt.title(\"Nombre de consommateurs uniques par type d'évènement\")\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 20,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "bc65a711-d172-4839-b487-3047280fc3a6",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtIAAAJICAYAAABMlwOPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAA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ffvhBGBgYSMeaHCtXrhQAxPXr14UQ7+5jS5YsESYmJsLR0VFkZWVJ9wUgqlSpIpo3by527twpjhw5Itq0aSN0dHTEv//+K8Xl9bib815ZW1sLDw8P4e/vL1avXi1KlSol2rZtK5ycnMS4ceNEQECAmD9/vtDW1hajR49W633Iy2cuPj5eOob+/PPP0mfpyZMnQgghbGxsRI0aNcTmzZtFUFCQ2LNnjxg7dqw4efLkB98zUh8LaSr03iyk09LSRLVq1UTTpk2lX9BvF9L+/v4CgFiwYIHS4+zYsUMAEL///rvUZm1tLQwMDERERITUFhYWJgCI8uXLi+TkZKn9r7/+EgDEgQMHpDZ3d3cBQPz6669KzzVnzhwBQAQHB0ttAIRCoRCvXr1Siu3QoYOoWLFirl8mo0aNEvr6+rni3+ftQi8rK0tYWVkJOzs7pV80iYmJwtzcXLRs2VJqW7hwoQAgHjx48MHnyM7OFhkZGSIoKEgAENeuXZO25aWQzsmpcePG0vsnhBAPHz4Uurq6SoV0TtG0Z88epccIDQ0VAMTKlSs/+FwjR458bz5vF9IzZ84UAERgYOB7H+/N/fvgwQNRt25dUbduXfHw4UMp5vz58wKA+OWXX5T
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 800x500 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Nombre Total de tickets achetés par Type d'évènements\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"total_tickets_by_event = customer.groupby('name_event_types')['nb_tickets'].sum()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"total_tickets_by_event.plot(kind='bar', figsize=(8, 5))\n",
|
|
|
|
|
"plt.xlabel(\"Type d'évènements\")\n",
|
|
|
|
|
"plt.ylabel('Nombre Total de tickets achetés')\n",
|
|
|
|
|
"plt.title(\"Nombre Total de tickets achetés par Type d'évènements\")\n",
|
|
|
|
|
"plt.xticks(rotation=45)\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 21,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "c95cc35c-abfc-47c7-9b8a-ac69bfd60dd8",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAwsAAAJgCAYAAADF4v+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAACNvklEQVR4nOzdd1hT1/8H8HfYIENQQERkSB0IuFAL1j1x1lE3DrBWrcXdOqq4tdY6W7TWgZPi3nuL4ldBBBfWgWIV3IiioJDz+8MfqTEJgkIu4Pv1PDwPOfcmeecmuckn59xzZUIIASIiIiIiovfoSB2AiIiIiIgKJhYLRERERESkFosFIiIiIiJSi8UCERERERGpxWKBiIiIiIjUYrFARERERERqsVggIiIiIiK1WCwQEREREZFaLBaIiIiIiEgtFgtERIXY3bt3YWNjgxEjRkgdhYgoz/To0QMVKlTAo0ePPvo2/P39Ua5cOSQnJ+ddsM9QroqFkJAQyGQyGBkZ4fbt2yrLGzRoAHd39zwLlxt9+vSBqampJPf9ITKZDBMnTszT20xPT8fvv/+Or776CpaWljAwMIC9vT06d+6MY8eO5el9FVYNGjRAgwYNPvl23rx5A1tbW3z55Zca15HL5Shbtiw8PT0/+f7UCQ4ORkhISL7c9oc4OTlBJpNp3JarVq2CTCaDTCbD0aNHtZpNSi9fvsTEiRPVPuasfeWtW7cUbX369IGTk5PSek5OTujTp89HZ8jIyEDXrl3Rq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zcuFHs379f6bG/7/3Hnd+v44/
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Nombre de Canaux de Ventes Moyen utilisé par les Consommateurs par type d'évènement\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"avg_supp_event = customer.groupby('name_event_types')['nb_suppliers'].mean()\n",
|
|
|
|
|
"avg_supp_event.plot(kind='bar')\n",
|
|
|
|
|
"plt.xlabel(\"Type d'évènement\")\n",
|
|
|
|
|
"plt.ylabel('Nombre de Canaux de Ventes Moyen')\n",
|
|
|
|
|
"plt.title(\"Nombre de Canaux de Ventes Moyen utilisé par les Consommateurs par type d'évènement\")\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 22,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "49d5fd2d-9bc1-43ac-9270-1efd73759854",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtIAAAJICAYAAABMlwOPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAACyfElEQVR4nOzdd1hT1/8H8HcYYYnIEBAH4kJR3IpiKzhwUupuxSIutGpFqtbRqjhR0aqtVsVtXVj3LAWtoqi4927rFkSRIcoM5/eHP+7XCCqJQQK+X8/j0+bck+Sd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HDx4UJ0+efOvz+/r6ChMTE6W2nGOPk5OT+P3338Vff/0lunfvLgCIyMhIIYQQcXFxIigoSAAQv/32m/S+xcXFCSGEWLt2rZDJZKJTp05i27ZtYvfu3cLT01Po6uqK/fv353pt9vb2YsyYMSIiIkLs2LEj3zny+xmlpaWJsLAwAUD0799fyvvPP/+89b05ePCgACDKly+f65hQsmRJ8e+//0p9N2/eLCZOnCi2b98uIiMjRWhoqHBzcxOlS5cWT548yfWZlS1bVgwcOFD8+eefYsuWLSIrK+utOd6876lTp4QQQqSnpwtbW1vRq1cvpX6ZmZnCzs5OdO/eXWrL+Zmxs7MTv/76q/jrr7+Ev7+/ACCGDh0q9fuQY9vrGd93DM1Lfr9vOnfuLMqXLy8UCoXS/UePHi3kcrl4+vSpECLv/WLy5MlCLpcLHx8f6X45x8+KFSuKdu3aiR07dogdO3YIZ2dnYW5uLhITE6W
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 800x500 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Nombre Total de tickets achetés sur Internet par Type d'évènements\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"nb_tickets_internet = customer.groupby('name_event_types')['nb_tickets_internet'].sum()\n",
|
|
|
|
|
"nb_tickets_internet.plot(kind='bar', figsize=(8, 5))\n",
|
|
|
|
|
"plt.xlabel(\"Type d'évènements\")\n",
|
|
|
|
|
"plt.ylabel('Nombre Total de tickets achetés sur Internet')\n",
|
|
|
|
|
"plt.title(\"Nombre Total de tickets achetés sur Internet par Type d'évènements\")\n",
|
|
|
|
|
"plt.xticks(rotation=45)\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"id": "dc071992-cf4d-4b9f-9c3b-3f0e98e20eff",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "4f9561a9-6a94-434e-b8e7-9b708f5b5529",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"# 3 - Caractéristiques Démographiques (peu exploitable)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 23,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "e50e2583-4b8f-478e-87ac-591dde200af8",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"Index(['customer_id', 'birthdate', 'street_id', 'is_partner', 'gender',\n",
|
|
|
|
|
" 'is_email_true', 'opt_in', 'structure_id', 'profession', 'language',\n",
|
|
|
|
|
" 'mcp_contact_id', 'last_buying_date', 'max_price', 'ticket_sum',\n",
|
|
|
|
|
" 'average_price', 'fidelity', 'average_purchase_delay',\n",
|
|
|
|
|
" 'average_price_basket', 'average_ticket_basket', 'total_price',\n",
|
|
|
|
|
" 'purchase_count', 'first_buying_date', 'country', 'age', 'tenant_id',\n",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
" 'event_type_id', 'nb_tickets', 'nb_purchases', 'total_amount',\n",
|
|
|
|
|
" 'nb_suppliers', 'vente_internet_max', 'purchase_date_min',\n",
|
|
|
|
|
" 'purchase_date_max', 'time_between_purchase', 'nb_tickets_internet',\n",
|
|
|
|
|
" 'name_event_types', 'avg_amount', 'nb_campaigns', 'nb_campaigns_opened',\n",
|
|
|
|
|
" 'time_to_open'],\n",
|
2024-02-11 11:47:58 +01:00
|
|
|
|
" dtype='object')"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 23,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"customer.columns"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 24,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "c724a315-9fe8-4874-be8f-a8115b17b5e2",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"def percent_of_na(df, column):\n",
|
|
|
|
|
" na_percentage = df[column].isna().mean() * 100\n",
|
|
|
|
|
" non_na_percentage = 100 - na_percentage\n",
|
|
|
|
|
" \n",
|
|
|
|
|
" labels = ['Valeurs Manquantes', 'Non-Valeurs Manquantes']\n",
|
|
|
|
|
" sizes = [na_percentage, non_na_percentage]\n",
|
|
|
|
|
" colors = ['#ff9999','#66b3ff']\n",
|
|
|
|
|
" explode = (0.1, 0)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140)\n",
|
|
|
|
|
" plt.axis('equal') \n",
|
|
|
|
|
" plt.title('Pourcentage de Valeurs Manquantes : {}'.format(column))\n",
|
|
|
|
|
" plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 25,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "58af5dcb-673e-4f4d-ad5c-f66ce1e8a22c",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAGZCAYAAACt2rSnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABeR0lEQVR4nO3dd3wUdf7H8demVyCBFAgJPfSQIL2HckGKCqKcIl1PBdspotypoGLDH5az4akU9Q48FVBQEKQJUpVu6FU6AUIJhLT5/TEmZkkC6ZPdvJ+PRx6ws7Mzn91sNu985zufsRmGYSAiIiIiheJidQEiIiIijkxhSkRERKQIFKZEREREikBhSkRERKQIFKZEREREikBhSkRERKQIFKZEREREikBhSkRERKQIFKZEREREikBhyglNnz4dm82W9eXm5kb16tUZPnw4R48etbq8UvXyyy8zd+5cq8sotIMHD2Kz2Zg+fXqRt/XNN99gs9mYMmVKnussXrwYm83GG2+8ke/tDhs2jJo1axa5vtK2fPnyrJ+RvF7frl27YrPZHPL5lYTVq1czYcIEEhMTrS6lTFmyZAktWrTA19cXm81myWeOo/4cOguFKSc2bdo01qxZw+LFi7nvvvuYOXMmHTt2JCkpyerSSo2jh6ni1Lt3b0JDQ5k6dWqe60ybNg13d3cGDx5cipVZy9/fn08++STH8gMHDrB8+XIqVKhgQVVl0+rVq3n++ecVprIxDIM777wTd3d3vv32W9asWUPnzp1LvY5nn32WOXPmlPp+xaQw5cSaNGlCmzZtiI2NZfz48YwdO5YDBw6Uari4cuUKuvxj2eDm5saQIUPYsGED27dvz3F/YmIic+bM4ZZbbiEoKMiCCgsmNTWVtLS0Im9n4MCBrFq1ij179tgtnzp1KmFhYbRv377I+xDHYRgGV65cyff6x44d4+zZs/Tr149u3brRpk0bAgICSrDC3NWpU4eYmJhS36+YFKbKkTZt2gBw6NAhAJKTkxk3bhy1atXCw8ODsLAwRo8eneOvTpvNxoQJE3Jsr2bNmgwbNizrdubhxUWLFjF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OHHCWLhwoQEYkyZNsnvsF198YQDGv//976xlgDF+/Pgc+6lRo4YxdOjQHPsdMmSI3Xr79+83XF1djUGDBuVZc1JSkhEYGGj07dvXbnl6errRrFkzo1WrVlnLxo8fn2vto0aNMry8vIyMjIysZb6+vnY15iUtLc1ITU01unXrZvTr1y9r+XvvvWcAxoIFC+zWv//++w3AmDZtWtayBg0aGDExMUZqaqrdun369DGqVq1qpKen57n/Dz74wACMb775xm75fffdV6z7MYw/v0+zZ8/OWrZ9+3YDMP75z3/m+pj09HQjNTXV+PTTTw1XV1fj7NmzWfcNHTrUqFGjRtbtNWvWGIAxefJku238/vvvhre3tzF27NisZde+hzJ17tzZ6Ny5c9btZcuWGYDRqVOnHOs2adLEuO222677nHOTuc0vv/zS2L9/v2Gz2Yz58+cbhmEYd9xxh9GlSxfDMAyjd+/eds/vWtd7bTp37mwAxrp16+we06hRIyMuLi7r9lNPPWXYbDZj8+bNduv16NHDAIxly5ZlLcvva3atzPf4yJEjjZiYGLv7ACMkJMS4cOFC1rITJ04YLi4uxiuvvJK17PXXXzcA48CBA3aPP3z4sOHm5mY8/PDDdssvXrxohIaGGnfeeadhGIaRkJBgAMZbb72VZ515OXjwoOHq6mqMGDHihusOHTrUAIy3337bbvlLL71kAMaqVauylgFGxYoV7b5vhmEYbdq0MYKDg42LFy9mLUtLSzOaNGliVK9
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"percent_of_na(customer, 'profession')"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"execution_count": 26,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "cc3437f7-8b36-4398-9da6-ff15e8e4c8d7",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-02-13 23:41:13 +01:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAm8AAAGZCAYAAADfFdYRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABbwUlEQVR4nO3dd1gUV9sG8HtZll6kN+kKdgG7KPZgjzXGGLEl0WhiisbyJpaoiRGj6VHfvIotscX2xRa7SZSIJVawImIBREBFOux8f4xsXJqLArPl/l3XXsnOzs48s+Dh3jlzzsgEQRBARERERDrBSOoCiIiIiEhzDG9EREREOoThjYiIiEiHMLwRERER6RCGNyIiIiIdwvBGREREpEMY3oiIiIh0CMMbERERkQ5heCMiIiLSIQxvVKGVK1dCJpOpHsbGxqhduzZGjRqFO3fuSF1ejfr888+xbds2qct4bgkJCZDJZFi5cuULb2v79u2QyWRYunRpuevs27cPMpkMixcv1ni7I0eOhI+PzwvXV9MOHz6s+jdS3ufbuXNnyGQynTy+6nDs2DHMnj0bDx48kLqUCs2ePRsymUzqMojUMLyRRqKiohAdHY19+/bhzTffxLp169C+fXtkZWVJXVqN0fXwVpV69eoFV1dXrFixotx1oqKioFAoMHz48BqsTFrW1tZYvnx5qeU3btzA4cOHYWNjI0FV2unYsWP49NNPtT68EWkjhjfSSKNGjdC6dWt06tQJs2bNwpQpU3Djxo0aDTM5OTngrXi1g7GxMSIiInDixAlcuHCh1OsPHjzA1q1b0bdvXzg5OUlQYeUUFBSgsLDwhbczZMgQ/PXXX7h69ara8hUrVsDDwwOhoaEvvA8iIoY3ei6tW7cGANy8eRMAkJubi+nTp8PX1xcmJibw8PDAhAkTSn2rlslkmD17dqnt+fj4YOTIkarnxd21e/fuxejRo+Hk5AQLCwvk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1j5+/HjBzMxMUCqVqmWWlpZqNZansLBQKCgoELp06SL0799ftfyHH34QAAi7d+9WW3/s2LECACEqKkq1rF69ekJwcLBQUFCgtm7v3r0FNzc3oaioqNz9L1myRAAgbN++XW35m2++WaX7EYR/f05btmxRLbtw4YIAQPj444/LfE9RUZFQUFAgrF69WpDL5UJ6errqtREjRgje3t6q59HR0QIAYdGiRWrbuHXrlmBubi5MmTJFtazk71CxDh06CB06dFA9P3TokABACAsLK7Vuo0aNhH79+lV4zGUp3uamTZuE+Ph4QSaTCTt27BAEQRAGDx4sdOzYURAEQejVq5fa8ZVU0WfToUMHAYBw/Phxtfc0aNBACA8PVz2fOnWqIJPJhDNnzqit161bNwGAcOjQIdUyTT+zkop/x8eMGSMEBwervQZAcHFxER49eqRalpycLBgZGQnz589XLVu4cKEAQLhx44ba+xMTEwVjY2Ph3XffVVuemZkpuLq6Cq+88oogCIJw//59AYDw9ddfl1tneRISEgS5XC6MHj36mesWtxHlUSqVQkFBgXDkyBEBgHD27FnVayNGjBAACBs3blR7T8+ePYXAwEDV88q0DeX9bEr+2ymp+Hdrzpw5goODg6ptu3jxogBAmDp1qtr669atEwCo/X6MHTtWsLKyEm7evKm27pdffikAEC5evFju/qlqsduUNNK6dWsoFApYW1ujd+/ecHV1xe7du+Hi4qL6plnyLM3gwYNhaWlZqquyMgYOHKj2fN++fSgqKsKECRPKfc+xY8eQnp6OESNGoLCwUPVQKpXo3r07Tpw4Uap7o2/fvmrPmzRpgtzcXNy7d0+jOpcuXYqQkBCYmZnB2NgYCoUCBw4cQFxcnGqdI0eOwNraGt27d1d779ChQ9W
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"percent_of_na(customer, 'language')"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-02-10 22:05:09 +01:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
2024-02-11 11:47:58 +01:00
|
|
|
|
"id": "c34164d2-5ab2-4923-a165-30dc5c070233",
|
2024-02-10 22:05:09 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": []
|
2024-02-10 19:37:38 +01:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"display_name": "Python 3 (ipykernel)",
|
|
|
|
|
"language": "python",
|
|
|
|
|
"name": "python3"
|
|
|
|
|
},
|
|
|
|
|
"language_info": {
|
|
|
|
|
"codemirror_mode": {
|
|
|
|
|
"name": "ipython",
|
|
|
|
|
"version": 3
|
|
|
|
|
},
|
|
|
|
|
"file_extension": ".py",
|
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
|
"name": "python",
|
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
|
"pygments_lexer": "ipython3",
|
2024-02-13 18:45:33 +01:00
|
|
|
|
"version": "3.11.6"
|
2024-02-10 19:37:38 +01:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 5
|
|
|
|
|
}
|