{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.422199Z",
"start_time": "2020-12-29T15:18:52.687480Z"
}
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"pd.set_option(\"display.max_columns\", 999)\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.ensemble import RandomForestClassifier\n",
"from sklearn.cluster import AgglomerativeClustering\n",
"from sklearn.preprocessing import StandardScaler\n",
"from sklearn.metrics import pairwise_distances\n",
"import plotly.graph_objects as go\n",
"import plotly.express as px\n",
"from sklearn.tree import DecisionTreeClassifier, _tree\n",
"from IPython.display import display, HTML"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data preparation"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.470857Z",
"start_time": "2020-12-29T15:18:53.424073Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" customerID | \n",
" gender | \n",
" SeniorCitizen | \n",
" Partner | \n",
" Dependents | \n",
" tenure | \n",
" PhoneService | \n",
" MultipleLines | \n",
" InternetService | \n",
" OnlineSecurity | \n",
" OnlineBackup | \n",
" DeviceProtection | \n",
" TechSupport | \n",
" StreamingTV | \n",
" StreamingMovies | \n",
" Contract | \n",
" PaperlessBilling | \n",
" PaymentMethod | \n",
" MonthlyCharges | \n",
" TotalCharges | \n",
" Churn | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 7590-VHVEG | \n",
" Female | \n",
" 0 | \n",
" Yes | \n",
" No | \n",
" 1 | \n",
" No | \n",
" No phone service | \n",
" DSL | \n",
" No | \n",
" Yes | \n",
" No | \n",
" No | \n",
" No | \n",
" No | \n",
" Month-to-month | \n",
" Yes | \n",
" Electronic check | \n",
" 29.85 | \n",
" 29.85 | \n",
" No | \n",
"
\n",
" \n",
" 1 | \n",
" 5575-GNVDE | \n",
" Male | \n",
" 0 | \n",
" No | \n",
" No | \n",
" 34 | \n",
" Yes | \n",
" No | \n",
" DSL | \n",
" Yes | \n",
" No | \n",
" Yes | \n",
" No | \n",
" No | \n",
" No | \n",
" One year | \n",
" No | \n",
" Mailed check | \n",
" 56.95 | \n",
" 1889.5 | \n",
" No | \n",
"
\n",
" \n",
" 2 | \n",
" 3668-QPYBK | \n",
" Male | \n",
" 0 | \n",
" No | \n",
" No | \n",
" 2 | \n",
" Yes | \n",
" No | \n",
" DSL | \n",
" Yes | \n",
" Yes | \n",
" No | \n",
" No | \n",
" No | \n",
" No | \n",
" Month-to-month | \n",
" Yes | \n",
" Mailed check | \n",
" 53.85 | \n",
" 108.15 | \n",
" Yes | \n",
"
\n",
" \n",
" 3 | \n",
" 7795-CFOCW | \n",
" Male | \n",
" 0 | \n",
" No | \n",
" No | \n",
" 45 | \n",
" No | \n",
" No phone service | \n",
" DSL | \n",
" Yes | \n",
" No | \n",
" Yes | \n",
" Yes | \n",
" No | \n",
" No | \n",
" One year | \n",
" No | \n",
" Bank transfer (automatic) | \n",
" 42.30 | \n",
" 1840.75 | \n",
" No | \n",
"
\n",
" \n",
" 4 | \n",
" 9237-HQITU | \n",
" Female | \n",
" 0 | \n",
" No | \n",
" No | \n",
" 2 | \n",
" Yes | \n",
" No | \n",
" Fiber optic | \n",
" No | \n",
" No | \n",
" No | \n",
" No | \n",
" No | \n",
" No | \n",
" Month-to-month | \n",
" Yes | \n",
" Electronic check | \n",
" 70.70 | \n",
" 151.65 | \n",
" Yes | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" customerID gender SeniorCitizen Partner Dependents tenure PhoneService \\\n",
"0 7590-VHVEG Female 0 Yes No 1 No \n",
"1 5575-GNVDE Male 0 No No 34 Yes \n",
"2 3668-QPYBK Male 0 No No 2 Yes \n",
"3 7795-CFOCW Male 0 No No 45 No \n",
"4 9237-HQITU Female 0 No No 2 Yes \n",
"\n",
" MultipleLines InternetService OnlineSecurity OnlineBackup \\\n",
"0 No phone service DSL No Yes \n",
"1 No DSL Yes No \n",
"2 No DSL Yes Yes \n",
"3 No phone service DSL Yes No \n",
"4 No Fiber optic No No \n",
"\n",
" DeviceProtection TechSupport StreamingTV StreamingMovies Contract \\\n",
"0 No No No No Month-to-month \n",
"1 Yes No No No One year \n",
"2 No No No No Month-to-month \n",
"3 Yes Yes No No One year \n",
"4 No No No No Month-to-month \n",
"\n",
" PaperlessBilling PaymentMethod MonthlyCharges TotalCharges \\\n",
"0 Yes Electronic check 29.85 29.85 \n",
"1 No Mailed check 56.95 1889.5 \n",
"2 Yes Mailed check 53.85 108.15 \n",
"3 No Bank transfer (automatic) 42.30 1840.75 \n",
"4 Yes Electronic check 70.70 151.65 \n",
"\n",
" Churn \n",
"0 No \n",
"1 No \n",
"2 Yes \n",
"3 No \n",
"4 Yes "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.read_csv(\"WA_Fn-UseC_-Telco-Customer-Churn.csv\", dtype={\"MonthlyCharges\": float})\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.580868Z",
"start_time": "2020-12-29T15:18:53.473590Z"
}
},
"outputs": [],
"source": [
"def to_num(total_charges, monthly_charges, tenure):\n",
" try:\n",
" return float(total_charges)\n",
" except:\n",
" return monthly_charges * tenure\n",
" \n",
"df_with_fixed_types = df.assign(TotalCharges=df.apply(\n",
" lambda x: to_num(x[\"TotalCharges\"], x[\"MonthlyCharges\"], x[\"tenure\"]), axis=1))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.588064Z",
"start_time": "2020-12-29T15:18:53.583284Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['SeniorCitizen', 'tenure', 'MonthlyCharges', 'TotalCharges'], dtype='object')"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_num = df_with_fixed_types.select_dtypes([int, float])\n",
"df_num.columns"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.596279Z",
"start_time": "2020-12-29T15:18:53.589598Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines',\n",
" 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection',\n",
" 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract',\n",
" 'PaperlessBilling', 'PaymentMethod', 'Churn'],\n",
" dtype='object')"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_cat = df_with_fixed_types.select_dtypes(\"object\").drop(columns=\"customerID\")\n",
"df_cat.columns"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.632172Z",
"start_time": "2020-12-29T15:18:53.597635Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" gender_Male | \n",
" Partner_Yes | \n",
" Dependents_Yes | \n",
" PhoneService_Yes | \n",
" MultipleLines_No phone service | \n",
" MultipleLines_Yes | \n",
" InternetService_Fiber optic | \n",
" InternetService_No | \n",
" OnlineSecurity_No internet service | \n",
" OnlineSecurity_Yes | \n",
" OnlineBackup_No internet service | \n",
" OnlineBackup_Yes | \n",
" DeviceProtection_No internet service | \n",
" DeviceProtection_Yes | \n",
" TechSupport_No internet service | \n",
" TechSupport_Yes | \n",
" StreamingTV_No internet service | \n",
" StreamingTV_Yes | \n",
" StreamingMovies_No internet service | \n",
" StreamingMovies_Yes | \n",
" Contract_One year | \n",
" Contract_Two year | \n",
" PaperlessBilling_Yes | \n",
" PaymentMethod_Credit card (automatic) | \n",
" PaymentMethod_Electronic check | \n",
" PaymentMethod_Mailed check | \n",
" Churn_Yes | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" 3 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
"
\n",
" \n",
" 4 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" gender_Male Partner_Yes Dependents_Yes PhoneService_Yes \\\n",
"0 0 1 0 0 \n",
"1 1 0 0 1 \n",
"2 1 0 0 1 \n",
"3 1 0 0 0 \n",
"4 0 0 0 1 \n",
"\n",
" MultipleLines_No phone service MultipleLines_Yes \\\n",
"0 1 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 1 0 \n",
"4 0 0 \n",
"\n",
" InternetService_Fiber optic InternetService_No \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 1 0 \n",
"\n",
" OnlineSecurity_No internet service OnlineSecurity_Yes \\\n",
"0 0 0 \n",
"1 0 1 \n",
"2 0 1 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" OnlineBackup_No internet service OnlineBackup_Yes \\\n",
"0 0 1 \n",
"1 0 0 \n",
"2 0 1 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" DeviceProtection_No internet service DeviceProtection_Yes \\\n",
"0 0 0 \n",
"1 0 1 \n",
"2 0 0 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" TechSupport_No internet service TechSupport_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" StreamingTV_No internet service StreamingTV_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" StreamingMovies_No internet service StreamingMovies_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" Contract_One year Contract_Two year PaperlessBilling_Yes \\\n",
"0 0 0 1 \n",
"1 1 0 0 \n",
"2 0 0 1 \n",
"3 1 0 0 \n",
"4 0 0 1 \n",
"\n",
" PaymentMethod_Credit card (automatic) PaymentMethod_Electronic check \\\n",
"0 0 1 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 1 \n",
"\n",
" PaymentMethod_Mailed check Churn_Yes \n",
"0 0 0 \n",
"1 1 0 \n",
"2 1 1 \n",
"3 0 0 \n",
"4 0 1 "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_dummies = pd.get_dummies(df_cat, drop_first=True)\n",
"df_dummies.head()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.651978Z",
"start_time": "2020-12-29T15:18:53.634023Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" SeniorCitizen | \n",
" tenure | \n",
" MonthlyCharges | \n",
" TotalCharges | \n",
" gender_Male | \n",
" Partner_Yes | \n",
" Dependents_Yes | \n",
" PhoneService_Yes | \n",
" MultipleLines_No phone service | \n",
" MultipleLines_Yes | \n",
" InternetService_Fiber optic | \n",
" InternetService_No | \n",
" OnlineSecurity_No internet service | \n",
" OnlineSecurity_Yes | \n",
" OnlineBackup_No internet service | \n",
" OnlineBackup_Yes | \n",
" DeviceProtection_No internet service | \n",
" DeviceProtection_Yes | \n",
" TechSupport_No internet service | \n",
" TechSupport_Yes | \n",
" StreamingTV_No internet service | \n",
" StreamingTV_Yes | \n",
" StreamingMovies_No internet service | \n",
" StreamingMovies_Yes | \n",
" Contract_One year | \n",
" Contract_Two year | \n",
" PaperlessBilling_Yes | \n",
" PaymentMethod_Credit card (automatic) | \n",
" PaymentMethod_Electronic check | \n",
" PaymentMethod_Mailed check | \n",
" Churn_Yes | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 29.85 | \n",
" 29.85 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
"
\n",
" \n",
" 1 | \n",
" 0 | \n",
" 34 | \n",
" 56.95 | \n",
" 1889.50 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
" 2 | \n",
" 0 | \n",
" 2 | \n",
" 53.85 | \n",
" 108.15 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" 3 | \n",
" 0 | \n",
" 45 | \n",
" 42.30 | \n",
" 1840.75 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
"
\n",
" \n",
" 4 | \n",
" 0 | \n",
" 2 | \n",
" 70.70 | \n",
" 151.65 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" SeniorCitizen tenure MonthlyCharges TotalCharges gender_Male \\\n",
"0 0 1 29.85 29.85 0 \n",
"1 0 34 56.95 1889.50 1 \n",
"2 0 2 53.85 108.15 1 \n",
"3 0 45 42.30 1840.75 1 \n",
"4 0 2 70.70 151.65 0 \n",
"\n",
" Partner_Yes Dependents_Yes PhoneService_Yes \\\n",
"0 1 0 0 \n",
"1 0 0 1 \n",
"2 0 0 1 \n",
"3 0 0 0 \n",
"4 0 0 1 \n",
"\n",
" MultipleLines_No phone service MultipleLines_Yes \\\n",
"0 1 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 1 0 \n",
"4 0 0 \n",
"\n",
" InternetService_Fiber optic InternetService_No \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 1 0 \n",
"\n",
" OnlineSecurity_No internet service OnlineSecurity_Yes \\\n",
"0 0 0 \n",
"1 0 1 \n",
"2 0 1 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" OnlineBackup_No internet service OnlineBackup_Yes \\\n",
"0 0 1 \n",
"1 0 0 \n",
"2 0 1 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" DeviceProtection_No internet service DeviceProtection_Yes \\\n",
"0 0 0 \n",
"1 0 1 \n",
"2 0 0 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" TechSupport_No internet service TechSupport_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 1 \n",
"4 0 0 \n",
"\n",
" StreamingTV_No internet service StreamingTV_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" StreamingMovies_No internet service StreamingMovies_Yes \\\n",
"0 0 0 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 0 \n",
"\n",
" Contract_One year Contract_Two year PaperlessBilling_Yes \\\n",
"0 0 0 1 \n",
"1 1 0 0 \n",
"2 0 0 1 \n",
"3 1 0 0 \n",
"4 0 0 1 \n",
"\n",
" PaymentMethod_Credit card (automatic) PaymentMethod_Electronic check \\\n",
"0 0 1 \n",
"1 0 0 \n",
"2 0 0 \n",
"3 0 0 \n",
"4 0 1 \n",
"\n",
" PaymentMethod_Mailed check Churn_Yes \n",
"0 0 0 \n",
"1 1 0 \n",
"2 1 1 \n",
"3 0 0 \n",
"4 0 1 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_features_and_target = pd.concat([df_num, df_dummies], axis=1)\n",
"df_features_and_target.head()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.658963Z",
"start_time": "2020-12-29T15:18:53.655447Z"
}
},
"outputs": [],
"source": [
"target = \"Churn_Yes\"\n",
"x = df_features_and_target.drop(columns=target)\n",
"y = df_features_and_target[target]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.668191Z",
"start_time": "2020-12-29T15:18:53.661950Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"count 7043.000000\n",
"mean 0.265370\n",
"std 0.441561\n",
"min 0.000000\n",
"25% 0.000000\n",
"50% 0.000000\n",
"75% 1.000000\n",
"max 1.000000\n",
"Name: Churn_Yes, dtype: float64"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.describe()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:53.674348Z",
"start_time": "2020-12-29T15:18:53.669826Z"
}
},
"outputs": [],
"source": [
"x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Random Forest"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.031911Z",
"start_time": "2020-12-29T15:18:53.676072Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"RandomForestClassifier(min_samples_leaf=20, n_estimators=200, n_jobs=8,\n",
" random_state=123)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rf = RandomForestClassifier(n_estimators=200, n_jobs=8, min_samples_leaf=20, random_state=123)\n",
"rf.fit(x_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.162408Z",
"start_time": "2020-12-29T15:18:54.033621Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"(0.8202903124013885, 0.7971631205673759)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rf.score(x_train, y_train), rf.score(x_test, y_test)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.282652Z",
"start_time": "2020-12-29T15:18:54.163872Z"
}
},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Features importances",
"type": "bar",
"x": [
"SeniorCitizen",
"tenure",
"MonthlyCharges",
"TotalCharges",
"gender_Male",
"Partner_Yes",
"Dependents_Yes",
"PhoneService_Yes",
"MultipleLines_No phone service",
"MultipleLines_Yes",
"InternetService_Fiber optic",
"InternetService_No",
"OnlineSecurity_No internet service",
"OnlineSecurity_Yes",
"OnlineBackup_No internet service",
"OnlineBackup_Yes",
"DeviceProtection_No internet service",
"DeviceProtection_Yes",
"TechSupport_No internet service",
"TechSupport_Yes",
"StreamingTV_No internet service",
"StreamingTV_Yes",
"StreamingMovies_No internet service",
"StreamingMovies_Yes",
"Contract_One year",
"Contract_Two year",
"PaperlessBilling_Yes",
"PaymentMethod_Credit card (automatic)",
"PaymentMethod_Electronic check",
"PaymentMethod_Mailed check"
],
"y": [
0.009333294125239179,
0.22096031572514985,
0.079733079090496,
0.14716604245992057,
0.006604914290798743,
0.007238270141615357,
0.005100754434839641,
0.002255981920654491,
0.0024951220184174783,
0.010420020186947508,
0.09621033203103412,
0.015664152144718835,
0.016759688489544965,
0.037972835077410456,
0.012590968030050404,
0.012137583557707096,
0.014854191357832018,
0.005797833670351991,
0.012648558676937196,
0.02742683629727992,
0.013906761587338083,
0.00637274266098079,
0.017322737189204115,
0.0073283208373548705,
0.03300808843773355,
0.07881598493793532,
0.016732373703868143,
0.00495792962164073,
0.07328315025478635,
0.004901137042212278
]
}
],
"layout": {
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
}
}
},
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"feature_importances = rf.feature_importances_\n",
"fig = go.Figure(data=[\n",
" go.Bar(name='Features importances', x=x.columns, y=feature_importances)\n",
"])\n",
"\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Clustering"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.286184Z",
"start_time": "2020-12-29T15:18:54.284296Z"
}
},
"outputs": [],
"source": [
"n_clusters = 5"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.341001Z",
"start_time": "2020-12-29T15:18:54.287616Z"
}
},
"outputs": [],
"source": [
"df_with_likely_churn = df_features_and_target[rf.predict_proba(x)[:, 1] > 0.3]\n",
"x_with_likely_churn = df_with_likely_churn.drop(columns=target)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.560510Z",
"start_time": "2020-12-29T15:18:54.342590Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"AgglomerativeClustering(linkage='average', n_clusters=5)"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x_scaled = StandardScaler().fit_transform(x_with_likely_churn)\n",
"aggl_clustering_euclidian = AgglomerativeClustering(n_clusters=n_clusters, linkage=\"average\")\n",
"aggl_clustering_euclidian.fit(x_scaled)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:54.754916Z",
"start_time": "2020-12-29T15:18:54.562214Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"AgglomerativeClustering(linkage='average', n_clusters=5)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x_with_rf_feature_importance = (x_scaled.T * feature_importances.reshape(-1, 1)).T\n",
"aggl_clustering_feature_importance = AgglomerativeClustering(n_clusters=n_clusters, linkage=\"average\")\n",
"aggl_clustering_feature_importance.fit(x_with_rf_feature_importance)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.735340Z",
"start_time": "2020-12-29T15:18:54.756350Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"AgglomerativeClustering(affinity='precomputed', linkage='average', n_clusters=5)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"encoding = rf.apply(x_with_likely_churn)\n",
"distance_matrix = pairwise_distances(encoding, metric=\"hamming\")\n",
"\n",
"aggl_clustering_from_rf = AgglomerativeClustering(n_clusters=n_clusters, \n",
" affinity=\"precomputed\", \n",
" linkage=\"average\")\n",
"aggl_clustering_from_rf.fit(distance_matrix)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analyze clustering"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.746353Z",
"start_time": "2020-12-29T15:18:55.737130Z"
}
},
"outputs": [],
"source": [
"df_clusters = df_with_likely_churn.assign(cluster_rf=list(map(str, aggl_clustering_from_rf.labels_)),\n",
" cluster_eucl=list(map(str, aggl_clustering_euclidian.labels_)),\n",
" cluster_fi=list(map(str, aggl_clustering_feature_importance.labels_)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Clusters interpretations"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.758562Z",
"start_time": "2020-12-29T15:18:55.747904Z"
}
},
"outputs": [],
"source": [
"# Functions retrieved from https://towardsdatascience.com/the-easiest-way-to-interpret-clustering-result-8137e488a127\n",
"\n",
"def pretty_print(df):\n",
" return display( HTML( df.to_html().replace(\"\\\\n\",\"
\") ) )\n",
"\n",
"def get_class_rules(tree: DecisionTreeClassifier, feature_names: list):\n",
" inner_tree: _tree.Tree = tree.tree_\n",
" classes = tree.classes_\n",
" class_rules_dict = dict()\n",
"\n",
" def tree_dfs(node_id=0, current_rule=[]):\n",
" # feature[i] holds the feature to split on, for the internal node i.\n",
" split_feature = inner_tree.feature[node_id]\n",
" if split_feature != _tree.TREE_UNDEFINED: # internal node\n",
" name = feature_names[split_feature]\n",
" threshold = inner_tree.threshold[node_id]\n",
" # left child\n",
" left_rule = current_rule + [\"({} <= {})\".format(name, threshold)]\n",
" tree_dfs(inner_tree.children_left[node_id], left_rule)\n",
" # right child\n",
" right_rule = current_rule + [\"({} > {})\".format(name, threshold)]\n",
" tree_dfs(inner_tree.children_right[node_id], right_rule)\n",
" else: # leaf\n",
" dist = inner_tree.value[node_id][0]\n",
" dist = dist/dist.sum()\n",
" max_idx = dist.argmax()\n",
" if len(current_rule) == 0:\n",
" rule_string = \"ALL\"\n",
" else:\n",
" rule_string = \" and \".join(current_rule)\n",
" # register new rule to dictionary\n",
" selected_class = classes[max_idx]\n",
" class_probability = dist[max_idx]\n",
" class_rules = class_rules_dict.get(selected_class, [])\n",
" class_rules.append((rule_string, class_probability))\n",
" class_rules_dict[selected_class] = class_rules\n",
"\n",
" tree_dfs() # start from root, node_id = 0\n",
" return class_rules_dict\n",
"\n",
"def cluster_report(data: pd.DataFrame, clusters, min_samples_leaf=50, pruning_level=0.01):\n",
" # Create Model\n",
" tree = DecisionTreeClassifier(min_samples_leaf=min_samples_leaf, ccp_alpha=pruning_level)\n",
" tree.fit(data, clusters)\n",
" \n",
" # Generate Report\n",
" feature_names = data.columns\n",
" class_rule_dict = get_class_rules(tree, feature_names)\n",
"\n",
" report_class_list = []\n",
" for class_name in class_rule_dict.keys():\n",
" rule_list = class_rule_dict[class_name]\n",
" combined_string = \"\"\n",
" for rule in rule_list:\n",
" combined_string += \"[{}] {}\\n\\n\".format(rule[1], rule[0])\n",
" report_class_list.append((class_name, combined_string))\n",
" \n",
" cluster_instance_df = pd.Series(clusters).value_counts().reset_index()\n",
" cluster_instance_df.columns = [\"class_name\", \"instance_count\"]\n",
" report_df = pd.DataFrame(report_class_list, columns=[\"class_name\", \"rule_list\"])\n",
" report_df = pd.merge(cluster_instance_df, report_df, on=\"class_name\", how=\"left\")\n",
" pretty_print(report_df.sort_values(by=\"class_name\").reset_index(drop=True)[[\"class_name\", \"instance_count\", \"rule_list\"]])"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.777440Z",
"start_time": "2020-12-29T15:18:55.760440Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" | \n",
" class_name | \n",
" instance_count | \n",
" rule_list | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 2197 | \n",
" [0.9995446265938069] (MonthlyCharges > 43.70000076293945) and (Contract_One year <= 0.5) and (PhoneService_Yes > 0.5)
| \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" 217 | \n",
" [1.0] (MonthlyCharges <= 43.70000076293945) and (PhoneService_Yes <= 0.5)
[1.0] (MonthlyCharges > 43.70000076293945) and (Contract_One year <= 0.5) and (PhoneService_Yes <= 0.5)
| \n",
"
\n",
" \n",
" 2 | \n",
" 2 | \n",
" 141 | \n",
" [0.986013986013986] (MonthlyCharges <= 43.70000076293945) and (PhoneService_Yes > 0.5)
| \n",
"
\n",
" \n",
" 3 | \n",
" 3 | \n",
" 1 | \n",
" NaN | \n",
"
\n",
" \n",
" 4 | \n",
" 4 | \n",
" 79 | \n",
" [0.9875] (MonthlyCharges > 43.70000076293945) and (Contract_One year > 0.5)
| \n",
"
\n",
" \n",
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cluster_report(x_with_likely_churn, aggl_clustering_euclidian.labels_, min_samples_leaf=20, pruning_level=0.01)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.795522Z",
"start_time": "2020-12-29T15:18:55.779227Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" | \n",
" class_name | \n",
" instance_count | \n",
" rule_list | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 17 | \n",
" [0.7727272727272727] (tenure > 20.5) and (TotalCharges <= 5715.474853515625) and (MonthlyCharges <= 69.2750015258789)
| \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" 1946 | \n",
" [0.9896854048478597] (tenure <= 20.5)
| \n",
"
\n",
" \n",
" 2 | \n",
" 2 | \n",
" 66 | \n",
" [0.9672131147540983] (tenure > 20.5) and (TotalCharges > 5715.474853515625)
| \n",
"
\n",
" \n",
" 3 | \n",
" 3 | \n",
" 1 | \n",
" NaN | \n",
"
\n",
" \n",
" 4 | \n",
" 4 | \n",
" 605 | \n",
" [0.9494290375203915] (tenure > 20.5) and (TotalCharges <= 5715.474853515625) and (MonthlyCharges > 69.2750015258789)
| \n",
"
\n",
" \n",
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cluster_report(x_with_likely_churn, aggl_clustering_feature_importance.labels_, min_samples_leaf=20, pruning_level=0.01)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:18:55.818884Z",
"start_time": "2020-12-29T15:18:55.802217Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" | \n",
" class_name | \n",
" instance_count | \n",
" rule_list | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 593 | \n",
" [1.0] (InternetService_Fiber optic <= 0.5) and (TechSupport_No internet service <= 0.5)
| \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" 1127 | \n",
" [0.9725177304964538] (InternetService_Fiber optic > 0.5) and (tenure <= 17.5)
| \n",
"
\n",
" \n",
" 2 | \n",
" 2 | \n",
" 541 | \n",
" [0.9460966542750929] (InternetService_Fiber optic > 0.5) and (tenure > 17.5) and (PaymentMethod_Electronic check > 0.5)
| \n",
"
\n",
" \n",
" 3 | \n",
" 3 | \n",
" 141 | \n",
" [1.0] (InternetService_Fiber optic <= 0.5) and (TechSupport_No internet service > 0.5)
| \n",
"
\n",
" \n",
" 4 | \n",
" 4 | \n",
" 233 | \n",
" [0.9787234042553191] (InternetService_Fiber optic > 0.5) and (tenure > 17.5) and (PaymentMethod_Electronic check <= 0.5)
| \n",
"
\n",
" \n",
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cluster_report(x_with_likely_churn, aggl_clustering_from_rf.labels_, min_samples_leaf=10, pruning_level=0.01)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clusters visualization"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:36:38.848088Z",
"start_time": "2020-12-29T15:36:38.843971Z"
}
},
"outputs": [],
"source": [
"def get_distinct_legend_elements_for_cluster_and_payement(fig):\n",
" displayed_clusters = []\n",
" for trace in fig.data:\n",
" name = trace.name.split(',')\n",
" if name[0] in displayed_clusters:\n",
" trace[\"showlegend\"] = False\n",
" else:\n",
" trace[\"name\"] = \"Cluster \" + name[0]\n",
" displayed_clusters.append(name[0])\n",
" \n",
" fig.add_trace(go.Scatter(y=[None], mode=\"markers\",\n",
" marker=dict(symbol=\"square\", color=\"grey\"),\n",
" name=\"Payment by electronic check\",\n",
" ))\n",
" fig.add_trace(go.Scatter(y=[None], mode=\"markers\",\n",
" marker=dict(symbol=\"x\", color=\"grey\"),\n",
" name=\"Payment with other methods\",\n",
" ))\n",
" \n",
" fig.update_layout(legend_title_text=\"Clusters and payment methods\")"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:36:51.396733Z",
"start_time": "2020-12-29T15:36:51.300415Z"
}
},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 1",
"marker": {
"color": "#636efa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 1",
"showlegend": true,
"type": "scattergl",
"x": [
29.85,
39.65,
30.2,
50.55,
35.45,
45.3,
24.8,
30.4,
25.25,
40.2,
41.15,
55,
35.9,
44.95,
41.9,
28.45,
29.95,
49.15,
34.7,
24.6,
30.15,
30.35,
40.05,
49.15,
43.65,
39.5,
35.55,
49.95,
30.9,
25.2,
49.65,
35,
42.6,
34.7,
35.65,
45.4,
44.85,
35.1,
43.3,
30.5,
34.25,
44.6,
33.65,
24.95,
25.15,
35.9,
48.55,
54.45,
34.5,
49.25,
53.95,
24.5,
44.55,
34.7,
44.4,
25.1,
54.45,
46.35,
30.4,
29.75,
29.9,
39.7,
24.4,
24.95,
40.75,
48.35,
25.25,
24.45,
24.25,
38.5,
24.45,
40.3,
50.6,
38.9,
25.05,
23.9,
39.85,
24.35,
40.1,
50.6,
24.75,
25.1,
24.7,
24.75,
29.4,
25.25,
35.75,
47.95,
50.75,
39.3,
35.2,
30.45,
30.75,
36.45,
24.85,
45.7,
29.65,
30.5,
24.8,
31.05,
25.2,
31.65,
39.05,
46.35,
35,
25.15,
35.1,
51.4,
29.6,
50.25,
41.6,
48.75,
24.7,
50.35,
23.45,
29.65,
50.75,
44.3,
25.05,
25.3,
29.15,
45.25,
45.3,
29.9,
39.65,
29.7,
50.35,
25.3,
35.15,
29.05,
44.4,
29.6
],
"xaxis": "x",
"y": [
1,
1,
1,
11,
1,
58,
1,
3,
1,
1,
3,
14,
28,
23,
21,
5,
9,
52,
2,
1,
13,
44,
4,
13,
12,
5,
1,
16,
2,
1,
51,
18,
2,
1,
11,
9,
57,
2,
1,
5,
5,
2,
4,
5,
1,
1,
4,
13,
7,
2,
41,
2,
4,
10,
7,
3,
53,
14,
2,
3,
4,
19,
1,
9,
9,
18,
1,
4,
1,
8,
20,
30,
3,
16,
2,
13,
35,
2,
1,
22,
3,
1,
7,
1,
8,
3,
1,
6,
14,
40,
18,
8,
3,
1,
38,
5,
10,
4,
1,
13,
11,
13,
18,
14,
1,
4,
13,
2,
3,
59,
11,
9,
1,
22,
1,
4,
15,
59,
1,
1,
13,
2,
13,
3,
19,
15,
1,
3,
3,
4,
6,
11
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 0",
"marker": {
"color": "#636efa",
"symbol": "square"
},
"mode": "markers",
"name": "1, 0",
"showlegend": false,
"type": "scattergl",
"x": [
24.3,
29.95,
24.8,
25.35,
25.25,
34.55,
24.25,
35.8,
40.3,
45,
34.8,
31.35,
24.6,
25.15,
25.8,
29.05,
50.95,
25.5,
25.05,
24.7,
48.75,
29.65,
30.25,
49.85,
38.55,
24.45,
35.25,
41.35,
48.25,
31,
33.9,
25.25,
43.25,
24.3,
25.1,
29.85,
36.45,
25.05,
29.8,
35,
50.95,
29.2,
40,
24.4,
30.55,
29.15,
24.45,
25.2,
29.9,
35.2,
34.25,
29.25,
25.05,
33.6,
40.1,
45.4,
35.1,
24.4,
57.2,
51,
24.35,
36.85,
40.4,
30.5,
34.7,
42.4,
25,
35.9,
25.2,
24.9,
40.15,
45.3,
29.7,
24.9,
25.85,
25.7,
35.05,
44.65,
24.4,
29.15,
29.7,
30.5,
24.2,
39,
35.45
],
"xaxis": "x",
"y": [
5,
1,
1,
1,
8,
10,
4,
11,
3,
6,
3,
1,
9,
1,
1,
2,
4,
8,
5,
1,
13,
3,
2,
12,
4,
2,
1,
3,
4,
3,
10,
1,
5,
2,
1,
2,
3,
1,
3,
4,
5,
3,
5,
2,
1,
1,
1,
1,
1,
3,
3,
8,
7,
1,
7,
5,
3,
1,
4,
5,
7,
3,
2,
6,
9,
4,
3,
1,
4,
1,
3,
1,
1,
2,
1,
1,
1,
1,
1,
4,
3,
1,
1,
16,
3
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=0
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "0, 1",
"marker": {
"color": "#EF553B",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 0",
"showlegend": true,
"type": "scattergl",
"x": [
70.7,
99.65,
104.8,
105.5,
90.05,
99.35,
69.7,
106.35,
84.5,
80.65,
90.25,
95.45,
100.5,
94.4,
75.3,
79.35,
74.7,
78.95,
98.5,
96.75,
91.65,
76.5,
89.85,
100.25,
74.4,
78.05,
85.95,
44.35,
71.15,
45.65,
82.4,
69.7,
104.4,
79.25,
91,
96.55,
79.9,
106.6,
86.8,
70.15,
73.15,
95,
75.35,
74.4,
70.4,
106.9,
89.85,
94.45,
107.05,
85.4,
105.05,
70,
74.5,
76.1,
89.35,
100.8,
95.45,
90.4,
74.9,
101.15,
89.05,
69.35,
80.6,
93.15,
44.8,
82.9,
70.35,
73.85,
103.4,
72.1,
90.4,
89.15,
54.1,
85.65,
85.45,
44,
44.3,
95.05,
81.35,
74.95,
83.3,
85.95,
53.45,
112.95,
80.4,
105.9,
94.75,
81.05,
104.15,
75.1,
101.15,
99.8,
55,
74.7,
80.25,
96.1,
81.45,
83.55,
100.15,
74.35,
59,
74.4,
94.1,
94.2,
80.5,
106.45,
74.35,
70.05,
100.05,
79.95,
85,
89.55,
70.2,
49.3,
100.25,
110.85,
70.5,
94.55,
89.2,
85.7,
95.15,
84.25,
105.5,
85.25,
89.55,
94.55,
89.5,
69.65,
80,
49.9,
49.25,
50.15,
83.15,
84.9,
85.95,
45.35,
94.5,
80.85,
87.25,
75.5,
80.45,
98.55,
90.35,
98.55,
89.25,
70.3,
74.25,
93.35,
82,
45.35,
52.2,
98.5,
85.35,
101.3,
69.55,
111.2,
106.35,
88.8,
78.85,
89.9,
64.35,
50.8,
73.65,
95.1,
105.1,
110.1,
83.9,
84.35,
100.55,
93.85,
100.5,
56.4,
72.85,
73.55,
80.7,
75.4,
81.7,
79.4,
81.15,
84.6,
83.25,
79.05,
99.05,
75.6,
95.1,
56.75,
86.1,
96,
90.55,
69.9,
75.25,
86.6,
94.3,
70.3,
95.35,
75.5,
90.1,
68.95,
49.5,
84.7,
86.1,
100.6,
83.75,
92.1,
79.45,
70.2,
80,
90.6,
89.25,
69.55,
98.85,
80.95,
74.3,
80.55,
79.75,
105.65,
60.25,
95.15,
80.4,
95.1,
53.8,
100.4,
101.35,
94.3,
60.15,
90.45,
78.9,
74.9,
70.15,
80.25,
69,
69.55,
80.3,
75.9,
78.3,
76.95,
96.15,
45.3,
90.45,
105.15,
90.15,
75.8,
79.3,
80.15,
80.25,
89.5,
107.5,
75,
44.75,
75.6,
44.05,
86.6,
85.2,
97.65,
109.55,
69.25,
87.25,
79.95,
88.35,
94.75,
95.05,
78.45,
70.2,
85.6,
82.15,
79.2,
69.25,
94.25,
85.8,
84.35,
66.25,
76,
93.85,
84.3,
95.5,
99.8,
101.1,
74.15,
73.85,
50.45,
91.4,
50.05,
94.5,
100,
85.3,
70.4,
98.75,
104.7,
96.85,
96.7,
88.2,
75.65,
94.25,
71.1,
74.7,
76.65,
84.8,
92.6,
95.4,
75.35,
100.85,
50.3,
69.95,
85.9,
80.8,
91.7,
74.95,
69.35,
95.35,
111.4,
45,
99.5,
80.45,
74.7,
70.35,
88.8,
90.25,
94.75,
86.45,
90.05,
102.6,
43.8,
45.05,
90.35,
84.65,
79.1,
69.75,
94.65,
76.85,
78.9,
80.15,
70.55,
85.3,
99.75,
73.85,
74.4,
82.75,
107.95,
94.9,
94.2,
59.85,
69.6,
69.9,
110.75,
89.95,
45.4,
113.2,
90.5,
79,
91.15,
71.65,
98.7,
76.35,
79.15,
85,
75.5,
85.3,
90.65,
74.85,
47.95,
45.1,
45,
96,
90.05,
45.55,
45.15,
73.2,
85.35,
83.75,
70.05,
86,
72.65,
78.95,
92,
78.5,
64.6,
99.8,
81.05,
79.1,
80.75,
75.35,
75.45,
81.1,
85.6,
74.95,
93.55,
90.7,
95.25,
84.75,
83.55,
45.7,
69.95,
74.95,
47.15,
80.2,
98.75,
86.45,
86.25,
81,
88.15,
74.3,
90.8,
79.35,
69.65,
77.4,
103.85,
49.4,
92.95,
48.7,
85.35,
95.6,
101.05,
71.35,
93.2,
80.85,
79.95,
94.05,
70.2,
75.25,
93.35,
54.35,
80.15,
80.45,
75.3,
70.55,
91,
66.85,
72.9,
84.1,
50.1,
74.6,
85,
80.55,
75.8,
98.5,
95.25,
60.85,
86.05,
85.15,
88.55,
91.3,
79.5,
86.25,
100.8,
86.3,
89.95,
89.95,
76.45,
70.5,
70,
95.85,
100.8,
102.45,
69.35,
80.2,
86.85,
91.55,
49.85,
99.85,
74.5,
104.15,
48.2,
85.65,
106.7,
45.2,
90.25,
47.8,
69.85,
90.6,
83.05,
94.25,
84,
80.35,
44.75,
82.65,
70.15,
70.3,
105.3,
55.45,
59.25,
88.35,
94.2,
96.25,
70.7,
70.05,
84.8,
99.95,
74.9,
104.85,
74.45,
89.35,
77.15,
106.35,
45,
100.7,
80.45,
90.75,
75.7,
89.7,
96.4,
91.45,
83.3,
100.4,
95.75,
94.6,
98.9,
101.3,
105.3,
49.4,
76.05,
100.6,
75.15,
70.1,
104.35,
69.75,
105.55,
70.3,
110.45,
99.25,
84.8,
85.3,
83.35,
90.35,
90.75,
95.15,
74.65,
79.85,
91,
78.75,
96.35,
44,
76.4,
98.7,
100.8,
51.55,
79.25,
85.7,
89.5,
86.05,
70.15,
92.55,
85.35,
80.1,
74.55,
100.95,
94.9,
104.9,
97.1,
55.2,
74.4,
69.7,
98.1,
98.7,
99.6,
94.2,
99,
50.15,
81.95,
69.35,
84.6,
85.75,
91.1,
86.1,
85.1,
99.15,
102.95,
64.9,
71,
79.7,
69.25,
74.1,
99.4,
93.5,
95.5,
74.55,
69.9,
75.6,
99.8,
93.85,
99,
100.75,
100.75,
90.4,
100.15,
85.95,
90,
89.95,
74.75,
84.45,
79.5,
74.95,
74.4,
89.2,
55.3,
84.95,
79.55,
71.05,
84.5,
69.3,
49.9,
44.45,
106.4,
100.05,
68.65,
84.4,
85.55,
77.85,
87.05,
84.8,
54.2,
74.05,
95.4,
84.45,
59.4,
99.55,
70,
45.3,
76.45,
101.75,
72.75,
94.85,
90.7,
101.4,
95.9,
89.85,
49.85,
80.55,
104.3,
55.25,
93.85,
80,
80.25,
74.65,
71.95,
94.2,
83.8,
86.65,
101.8,
78.45,
87.45,
91.1,
70.75,
101.35,
81.7,
68.25,
105.1,
79.15,
84.9,
95.45,
64,
69.6,
94.75,
80,
78.45,
70.75,
84.45,
75.55,
85.65,
70.25,
97.8,
106.3,
75.35,
89.4,
84.05,
99.5,
59.2,
83.2,
54.9,
103.9,
55.6,
95.1,
75.5,
73.75,
96.05,
88.95,
101.9,
89.5,
69.8,
94.3,
101.05,
94.7,
90.55,
91.15,
45.9,
91.4,
91.5,
104.75,
74.15,
50.7,
77.8,
83.45,
51.05,
75.35,
69.3,
75.2,
84.75,
75.25,
43.3,
84.85,
95.05,
50.35,
74.2,
59.45,
93.8,
95.7,
96.2,
79.6,
71.05,
85.25,
80.5,
89.8,
50.75,
79.5,
81.2,
80.5,
86.25,
45.65,
55.35,
46.3,
84.2,
75.25,
73.7,
105.75,
49.55,
71.25,
95.9,
104.1,
69.7,
45.15,
111.5,
75.1,
101.75,
45.8,
101,
69.1,
71.15,
98.85,
49.15,
89.6,
79.15,
80.4,
78.5,
102,
99.65,
96.6,
69.8,
84.05,
71.65,
106.5,
49.35,
94.25,
68.95,
93.85,
76.05,
49,
80.35,
55.8,
79.05,
95,
98.4,
84.05,
105.2,
101.4,
89.8,
69.1,
91.25,
81.45,
49.1,
100.3,
85.45,
79.85,
71.65,
73.55,
104.65,
44.55,
74.25,
74.2,
101,
100.2,
96.5,
73.9,
45.45,
102.55,
100.2,
103.1,
43.75,
100.65,
45.75,
79.8,
88.85,
74.95,
74.95,
109.1,
78.8,
106.4,
69.1,
90.2,
78.55,
78.65,
42.9,
44,
96.2,
74.4,
94.8,
105.3,
57.55,
84.55,
105.7,
85.2,
76.5,
92.9,
93.5,
69.6,
99.75,
50.55,
100.55,
94.1,
51.35,
98.9,
84.85,
70.5,
94.85,
50.15,
74,
79.55,
98.7,
95.8,
69.6,
100.2,
78.05,
73.6,
74.75,
74,
44.75,
93.55,
95.55,
94.95,
98.6,
85.45,
80.5,
84.8,
75.2,
89,
74.9,
101.25,
86.55,
101.35,
98.65,
103.3,
84.75,
85.55,
90.6,
90.05,
75.1,
75.85,
68.5,
73.5,
70.05,
94,
88.75,
84.45,
104.45,
70.2,
90.95,
88.05,
91.85,
73.9,
96.55,
69.75,
101.25,
79.55,
70.15,
89.1,
51.1,
94.4,
78.25,
76.4,
84.95,
44.15,
75.75,
80.3,
74.9,
50.35,
89.45,
79.85,
80.85,
86.5,
103.95,
89.55,
89.15,
103.3,
69.8,
75.65,
90.7,
78.5,
79.9,
99.7,
98.5,
94.65,
78.2,
94.2,
88.45,
69.85,
79.9,
54.2,
74.9,
70.35,
84.3,
70.1,
78.3,
96.8,
94.4,
84.3,
80.6,
99.55,
81.25,
75.3,
99.25,
79.75,
100.05,
69.35,
85.8,
80.55,
84.5,
67.75,
85.25,
105.35,
106.15,
81.15,
85.05,
102.8,
79.5,
94.75,
49.45,
94.7,
92.5,
75.55,
93.6,
70,
104.4,
70.3,
86.2,
74.9,
100.25,
99.85,
83.85,
94.1,
94.65,
104.35,
78.85,
61.15,
78.95,
84.9,
74.35,
84.6,
94.65,
100.45,
76.5,
49.2,
80.85,
91.25,
78.95,
45.15,
79.4,
68.95,
96.8,
80.65,
84.85,
94,
89.85,
99.8,
90,
53.95,
83.05,
105.5,
81,
69.8,
94.6,
54.55,
76.25,
70.4,
91.15,
70.95,
48.8,
100.85,
99.5,
104.4,
65.6,
84.35,
85.7,
74.7,
90.8,
107.55,
106.15,
90.85,
79.55,
46,
103.45,
89.4,
50.9,
81,
98.35,
91.65,
84.3,
100.2,
90.85,
95.7,
63.6,
44.1,
96.05,
44.7,
74.35,
94.5,
95.6,
70.3,
69.8,
85.55,
101.5,
89.15,
78.8,
79.6,
90.6,
104.6,
75.85,
99.15,
82.35,
75.35,
104.45,
92.15,
95.7,
54.4,
77,
75.3,
73.5,
83.4,
70.4,
94,
99.7,
96.1,
104.25,
80.2,
89.25,
86.2,
94.55,
104.2,
76.25,
74.35,
53.65,
69.65,
80.8,
44.8,
84.1,
69.35,
104.4,
101.5,
54.3,
103.95,
89.4,
80.35,
84.9,
92.55,
96.2,
98.75,
101.15,
81.15,
88.7,
79.75,
94.55,
76.05,
101.1,
90.65,
90.1,
53.75,
89.3,
95.2,
74.5,
79.65,
105.9,
89.2,
83.65,
90.1,
45.6,
88.35,
85.45,
89.8,
98.65,
89.35,
84.5,
70.3,
104.95,
74.75,
50.8,
61.3,
80.25,
78.9,
84.75,
99.45,
70.6,
84.85,
89.15,
80.85,
100.45,
89.45,
76.4,
54.5,
79.9,
69.55,
88.85,
79.7,
74.2,
84.6,
69.05,
73.65,
77.75,
84.35,
84.95,
73.85,
46,
79.4,
94.4,
80.35,
81.1,
78.85,
89.45,
97.9,
79.8,
80.2,
95.15,
69.85,
84.95,
88.45,
83.75,
70.8,
75.5,
74.85,
96.65,
103.45,
79.6,
75.9,
76.2,
84.3,
48.6,
79,
49.75,
94.75,
93,
70.25,
95.25,
101.25,
60,
86.55,
74.65,
104.4,
85.3,
79.3,
86.85,
75.7,
45.55,
90.8,
97.95,
55.3,
89.4,
87.3,
99.95,
70.15,
96.5,
91.55,
70.25,
89.2,
69.65,
89.3,
74.8,
87.55,
102.4,
106.4,
85.2,
75.55,
81.3,
85.45,
71,
85.05,
44.6,
44.4,
70.55,
70.3,
70.45,
75.4,
78.75,
75.8,
76.1,
69.1,
88.25,
97.35,
69.65,
75.4,
100.6,
86,
95.6,
84.5,
85,
78.95,
78.8,
89.25,
98,
94.45,
105,
93.85,
84,
108.9,
84.85,
89.9,
78.55,
99.45,
89.15,
89.75,
85.15,
94.6,
94.7,
94.25,
74.95,
105.2,
89.75,
82.85,
103.85,
83.6,
74.55,
56.15,
105.3,
88.95,
76.6,
94.45,
55,
87.1,
94.95,
44.55,
101.1,
55.4,
90.6,
70.2,
78.1,
95.05,
104.2,
90,
99.5,
91.05,
71,
89.1,
70.65,
104.2,
79.25,
70.1,
77.85,
54.3,
80.5,
74.7,
80.7,
85,
85.75,
98.25,
69,
100.5,
69.95,
93.3,
49.15,
74.5,
73,
70.1,
70.65,
93.5,
83.95,
79.45,
75.55,
95,
70.35,
95.85,
79.15,
79,
75.85,
91.85,
69.65,
74.3,
100.35,
104.1,
94.4,
74.85,
101.95,
94,
84.05,
104.35,
101.7,
73.1,
70.1,
77.5,
50.5,
74.4,
101.35,
90.65,
100.05,
49.15,
95.65,
75.05,
94.4,
101.45,
97,
69.5,
69.2,
69.65,
101.85,
103.05,
82.3,
79.25,
84.6,
94.2,
48.95,
54.85,
45.3,
85.85,
95.2,
105.8,
79.85,
74.65,
56.25,
106.1,
68.65,
100,
73.8,
100.2,
106.2,
99.7,
90.1,
70.85,
94.1,
44.5,
105,
101.4,
80.8,
76.45,
91.3,
95.75,
78.75,
74.5,
50.15,
86.5,
81.45,
69.15,
54.65,
79.55,
103.65,
99.05,
43.95,
91.05,
79.2,
96.55,
85.6,
74.3,
98.35,
85.45,
95.9,
100.75,
89.2,
100.6,
70.75,
89.55,
55.9,
96,
100.1,
85,
79.9,
49.4,
69.2,
92.5,
69.65,
109.95,
74.95,
70.3,
98.8,
81.3,
86.8,
84.2,
79.7,
100.75,
89.1,
91.65,
88.85,
95.45,
91.1,
89.5,
86.05,
101.35,
80.7,
105.9,
55.35,
85.5,
103,
69.35,
73.85,
69.6,
80.15,
82,
45.05,
86.25,
95.55,
101.25,
89.5,
74.35,
93.6,
88.05,
76.1,
80.5,
81,
74.45,
89.2,
49.95,
103.5,
75.75
],
"xaxis": "x",
"y": [
2,
8,
28,
25,
21,
47,
5,
34,
49,
2,
43,
18,
47,
9,
3,
1,
1,
12,
25,
55,
43,
37,
3,
10,
3,
27,
13,
2,
8,
1,
20,
2,
2,
13,
6,
20,
1,
19,
23,
4,
18,
11,
4,
15,
2,
13,
57,
16,
20,
5,
52,
1,
8,
24,
6,
35,
4,
4,
32,
38,
22,
5,
5,
24,
1,
11,
2,
7,
63,
1,
2,
7,
16,
2,
55,
1,
2,
42,
3,
29,
22,
10,
2,
16,
36,
60,
8,
28,
24,
1,
4,
7,
1,
1,
24,
5,
20,
8,
15,
1,
2,
2,
20,
2,
6,
61,
5,
5,
34,
2,
1,
12,
11,
1,
35,
28,
9,
35,
4,
1,
25,
23,
65,
10,
1,
20,
2,
2,
1,
1,
2,
3,
35,
29,
4,
3,
33,
5,
45,
25,
2,
10,
2,
20,
22,
3,
41,
15,
2,
2,
1,
10,
6,
40,
1,
21,
61,
37,
4,
1,
5,
1,
20,
3,
15,
10,
6,
7,
63,
17,
9,
4,
10,
1,
26,
16,
22,
3,
13,
4,
4,
6,
35,
8,
22,
4,
32,
2,
1,
1,
11,
1,
4,
2,
7,
27,
18,
2,
1,
5,
45,
8,
26,
8,
38,
14,
5,
23,
24,
3,
46,
2,
13,
1,
9,
39,
3,
2,
3,
23,
5,
32,
15,
43,
1,
7,
17,
1,
3,
1,
17,
7,
3,
2,
34,
3,
16,
1,
23,
45,
11,
1,
7,
2,
4,
7,
30,
8,
6,
5,
11,
16,
18,
34,
47,
1,
14,
10,
18,
9,
13,
4,
4,
10,
61,
1,
22,
34,
29,
24,
8,
1,
2,
15,
35,
60,
15,
12,
44,
1,
2,
1,
31,
16,
5,
4,
24,
41,
13,
22,
19,
15,
64,
18,
1,
17,
14,
17,
3,
14,
8,
4,
5,
25,
6,
1,
1,
4,
10,
11,
3,
66,
12,
2,
2,
1,
30,
23,
35,
30,
38,
1,
17,
37,
42,
1,
5,
51,
9,
29,
4,
27,
3,
1,
3,
4,
5,
3,
3,
17,
1,
1,
1,
52,
14,
2,
41,
13,
2,
2,
1,
10,
1,
23,
32,
1,
32,
65,
8,
1,
1,
1,
24,
54,
10,
1,
19,
52,
3,
1,
2,
16,
5,
3,
7,
3,
49,
1,
3,
2,
1,
1,
7,
23,
11,
1,
31,
10,
16,
17,
1,
1,
23,
5,
2,
47,
10,
16,
5,
15,
1,
26,
22,
16,
3,
48,
2,
37,
7,
34,
1,
56,
1,
32,
17,
1,
9,
11,
3,
33,
1,
22,
31,
1,
1,
15,
7,
11,
21,
1,
25,
30,
2,
2,
29,
13,
2,
4,
30,
2,
1,
1,
7,
1,
14,
20,
28,
17,
4,
10,
1,
66,
1,
11,
2,
3,
40,
1,
23,
1,
44,
7,
4,
12,
1,
8,
2,
3,
11,
15,
21,
5,
3,
1,
14,
1,
35,
5,
1,
8,
1,
8,
5,
2,
1,
7,
31,
7,
14,
4,
5,
1,
47,
2,
46,
14,
6,
2,
25,
16,
2,
9,
7,
60,
1,
31,
30,
12,
8,
3,
57,
7,
1,
31,
1,
61,
10,
33,
7,
1,
47,
33,
24,
1,
19,
4,
19,
28,
5,
34,
1,
2,
3,
13,
15,
10,
2,
5,
1,
13,
17,
9,
4,
9,
3,
10,
32,
2,
4,
1,
8,
12,
49,
4,
11,
60,
1,
1,
7,
12,
26,
6,
14,
22,
61,
70,
11,
1,
1,
1,
6,
18,
32,
9,
11,
1,
9,
41,
7,
51,
27,
22,
3,
62,
24,
37,
69,
2,
12,
27,
14,
32,
44,
3,
16,
1,
50,
1,
25,
1,
2,
23,
37,
21,
6,
2,
4,
8,
11,
5,
9,
36,
13,
16,
38,
17,
1,
14,
15,
4,
3,
39,
31,
25,
34,
8,
9,
54,
1,
1,
40,
41,
7,
13,
12,
23,
10,
17,
31,
34,
10,
29,
12,
1,
33,
34,
4,
40,
35,
5,
1,
38,
3,
1,
2,
9,
1,
4,
1,
51,
41,
7,
12,
2,
11,
1,
13,
1,
21,
11,
1,
6,
4,
12,
4,
53,
10,
1,
21,
24,
18,
1,
37,
4,
5,
15,
56,
18,
4,
18,
38,
8,
1,
2,
43,
19,
8,
3,
43,
50,
5,
2,
15,
31,
50,
32,
1,
7,
20,
26,
5,
1,
32,
40,
3,
2,
1,
3,
1,
51,
39,
21,
26,
1,
1,
29,
30,
8,
9,
44,
1,
42,
1,
46,
1,
1,
32,
6,
32,
20,
46,
11,
11,
57,
3,
2,
2,
2,
41,
4,
7,
1,
2,
4,
15,
4,
1,
1,
1,
41,
12,
66,
35,
10,
6,
26,
12,
15,
42,
18,
10,
1,
18,
24,
1,
3,
1,
43,
4,
36,
4,
8,
17,
30,
9,
9,
22,
1,
12,
18,
3,
11,
52,
1,
47,
1,
20,
2,
1,
1,
1,
49,
6,
17,
6,
3,
7,
28,
8,
11,
14,
4,
2,
39,
1,
14,
7,
5,
58,
40,
1,
10,
1,
55,
9,
58,
14,
1,
68,
1,
7,
9,
1,
7,
24,
27,
19,
56,
1,
24,
25,
35,
7,
6,
15,
12,
62,
29,
28,
22,
5,
1,
4,
14,
3,
1,
11,
5,
8,
22,
29,
46,
4,
32,
9,
3,
31,
37,
25,
24,
1,
2,
1,
15,
17,
19,
11,
18,
2,
8,
1,
1,
6,
31,
24,
9,
21,
69,
24,
17,
19,
18,
4,
16,
3,
3,
30,
10,
38,
18,
29,
16,
1,
4,
3,
7,
1,
3,
1,
12,
55,
17,
1,
28,
11,
8,
10,
23,
15,
30,
1,
3,
1,
12,
2,
27,
34,
60,
31,
1,
21,
54,
4,
6,
8,
5,
2,
26,
1,
33,
2,
15,
4,
25,
10,
9,
24,
72,
21,
24,
1,
6,
36,
1,
12,
15,
34,
2,
5,
4,
33,
1,
2,
3,
5,
19,
18,
31,
1,
15,
46,
22,
1,
22,
8,
16,
1,
24,
9,
37,
3,
31,
2,
7,
34,
37,
10,
4,
20,
37,
1,
5,
33,
28,
36,
2,
4,
15,
17,
4,
4,
26,
4,
29,
2,
1,
50,
3,
1,
18,
2,
11,
43,
14,
1,
6,
10,
9,
12,
20,
2,
19,
22,
9,
36,
21,
4,
23,
42,
15,
8,
3,
1,
8,
50,
1,
11,
47,
44,
24,
15,
1,
11,
41,
17,
9,
1,
7,
1,
9,
4,
36,
3,
41,
30,
1,
29,
22,
47,
8,
17,
7,
16,
8,
9,
20,
2,
12,
31,
37,
33,
6,
11,
6,
3,
8,
1,
60,
29,
19,
1,
1,
13,
30,
26,
26,
1,
5,
3,
50,
10,
1,
4,
2,
32,
36,
12,
1,
6,
26,
13,
30,
9,
2,
1,
9,
1,
10,
7,
29,
1,
9,
1,
55,
6,
8,
11,
1,
15,
30,
21,
1,
14,
3,
3,
13,
5,
37,
1,
26,
4,
23,
17,
3,
7,
13,
39,
1,
1,
1,
42,
1,
7,
1,
18,
24,
1,
37,
39,
1,
8,
5,
21,
15,
29,
19,
1,
2,
20,
4,
2,
13,
19,
19,
13,
15,
16,
3,
27,
1,
1,
18,
36,
63,
39,
5,
34,
5,
17,
1,
9,
3,
1,
35,
1,
20,
7,
13,
3,
3,
21,
17,
21,
1,
18,
10,
1,
49,
49,
1,
14,
26,
6,
13,
5,
3,
26,
8,
34,
1,
31,
18,
42,
5,
7,
14,
3,
36,
16,
2,
42,
6,
6,
53,
5,
3,
5,
68,
25,
12,
29,
6,
8,
2,
12,
59,
1,
1,
1,
14,
47,
52,
23,
25,
32,
9,
19,
4,
31,
1,
10,
43,
4,
1,
18,
5,
46,
5,
6,
7,
5,
1,
1,
3,
3,
1,
1,
2,
23,
26,
2,
5,
26,
2,
2,
1,
4,
9,
17,
14,
57,
13,
47,
42,
9,
7,
2,
13,
65,
4,
55,
2,
51,
1,
1,
32,
4,
47,
6,
2,
10,
1,
1,
13,
1,
1,
1,
40,
52,
1,
3,
13,
42,
1,
6,
1,
2,
10,
28,
2,
9,
1,
21,
1,
33,
9,
14,
61,
15,
9,
1,
13,
2,
38,
43,
1,
1,
12,
6,
16,
1,
16,
7,
27,
1,
1,
9,
38,
35,
2,
3,
2,
5,
18,
14,
49,
28,
68,
13,
11,
57,
2,
24,
4,
12,
54,
1,
42,
4,
1,
37,
3,
35,
4,
1,
55,
27,
7,
6,
6,
11,
25,
14,
4,
1,
13,
6,
21,
8,
3,
3,
9,
9,
43,
1,
56,
1,
5,
13,
12,
9,
42,
27,
25,
4,
36,
50,
27,
13,
23,
1,
41,
1,
63,
1
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=0
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "0, 0",
"marker": {
"color": "#EF553B",
"symbol": "square"
},
"mode": "markers",
"name": "0, 0",
"showlegend": false,
"type": "scattergl",
"x": [
53.85,
89.1,
103.7,
95.5,
45.25,
97.85,
49.25,
99.1,
80.65,
79.85,
49.05,
64.5,
75.15,
103.8,
99.3,
70.45,
95,
80.9,
84.15,
70.9,
74.45,
76.45,
105.35,
45.3,
84.5,
80.05,
78.3,
46,
80,
50.05,
55.2,
89.9,
84.6,
54.4,
48.55,
44.6,
105,
70.6,
50.55,
95.15,
73.6,
82.65,
80.6,
94.8,
84.8,
80.25,
96.5,
96.1,
104.95,
50.65,
90.85,
95.6,
109.9,
73.95,
93.95,
73.25,
75.3,
69.85,
75.6,
89.85,
55.05,
69.55,
70.05,
69,
99.7,
78,
75.2,
75.6,
86.05,
80.35,
75.3,
45.6,
65.55,
74.55,
78.55,
90.05,
110.75,
45.7,
69.55,
74.6,
95.1,
74.75,
45.65,
75.05,
107.95,
64.4,
71.1,
75.1,
49.25,
79.85,
86,
85.65,
91.7,
79.35,
44.05,
75.05,
85.9,
78.85,
88.9,
44.8,
64.2,
84.6,
86.2,
89.45,
95.6,
44.4,
94.65,
80.6,
103.85,
81.1,
98.9,
98.3,
89,
75.4,
75.1,
79.85,
74.4,
91.35,
44.95,
44.7,
45.7,
100.3,
80.6,
70,
69.55,
99.55,
50.15,
95.9,
88.3,
90.45,
69.75,
99.3,
50.25,
97.1,
84.7,
89.55,
90.05,
99.05,
69.75,
49.05,
98.05,
114.5,
89.7,
100.45,
74.75,
56.15,
94.4,
78.95,
98.85,
74.65,
86.05,
104.05,
75.2,
96.65,
89.75,
80,
109.9,
87.9,
85.7,
86,
90.55,
45.85,
58.7,
45.05,
50.3,
62.8,
80.7,
85.6,
45,
75.35,
54.7,
75.2,
70.15,
95.3,
70.7,
49.95,
82.85,
99.8,
101.45,
84.4,
99.95,
75.55,
55.8,
98.55,
80.8,
74.6,
74.4,
55.05,
51.25,
79.5,
88.45,
90,
45.85,
95.6,
48.95,
89.05,
75.75,
75.9,
85.35,
109.8,
79.5,
85.8,
44.3,
96.05,
74.6,
50.15,
113.6,
104.4,
83.8,
74.25,
87.15,
84.75,
89.65,
48.75,
78.1,
89.65,
43.85,
79.35,
86.55,
73.85,
46.2,
45.95,
44.05,
45.55,
45.1,
90.95,
50.9,
85.35,
107.35,
54.65,
49.8,
95.5,
95.4,
84.85,
70.7,
90.9,
89.15,
75.5,
89.85,
87.1,
75.9,
45.3,
60.95,
70.6,
96.8,
108.15,
69.75,
90.75,
80.55,
85.2,
44.45,
86.15,
50.5,
74.4,
43.95,
50.2,
70.1,
101.15,
71.45,
51.2,
80.1,
98.15,
112.95,
70.9,
100.15,
99.5,
71.55,
55.9,
85.3,
97.7,
98.6,
85.7,
102.05,
85.05,
70.4,
106.4,
46.1,
45.95,
93.9,
85.55,
106.35,
91.05,
90.7,
93,
94.55,
86.45,
99.25,
73.55,
103.35,
81.5,
90,
74.2,
70.45,
85.65,
98.4,
86.05,
44.55,
93.85,
74.25,
69.5,
99.65,
85.25,
80.1,
98.15,
69.95,
45.45,
105.95,
94.05,
54.75,
95.65,
88.4,
100.55,
80.2,
80.55,
83.4,
70.7,
84.35,
55.55,
89.6,
101.35,
70.05,
50.4,
79.65,
80.45,
50.1,
94.85,
55.3,
44.4,
95.65,
74.3,
98.1,
88.95,
88.35,
94.65,
50.15,
62.15,
101.4,
44.6,
63.75,
94.7,
87,
79.95,
45.05,
89,
73.5,
92.35,
105.35,
102.65,
83.8,
105.85,
75.45,
80.3,
70.25,
94.5,
60.65,
89.15,
45.4,
84.15,
85.4,
45.8,
75.75,
68.65,
105.35,
95.65,
53.5,
79.65,
75.15,
85.95,
69.95,
74.3,
95.1,
76.65,
99.15,
75.1,
81.5,
50.45,
44.9,
55.15,
106.75,
104.5,
93.2,
70.55,
100.85,
88.5,
69.1,
77.95,
46.3,
83.15,
74.15,
44.15,
85.45,
85.05,
50.85,
75.45,
54.85,
70.6,
84.3,
50.7,
53.4,
87.8,
50.6,
71.3,
98.8,
61.45,
44.95,
88.8,
85.2,
83.85,
106.15,
45.3,
73.25,
46.6,
85.35,
44.9,
84.8,
74.6,
79.15,
90.5,
89.65,
99.15,
75,
99.45,
70.1,
70.2,
95.7,
45.85,
100.15,
72.25,
79.65,
50.15,
88.4,
50.8,
75,
69.15,
50.75,
70.8,
89.05,
104.5,
50.6,
58.5,
49.55,
89.35,
73.6,
50.4,
75.75,
54.45,
94.05,
55.3,
74.75,
100.5,
95,
70.85,
49.2,
74.05,
101.55,
44.8,
80.15,
69.95,
93.55,
94.65,
80.85,
95.95,
50.95,
73.85,
69.95,
85.8,
90.7,
54.35,
45.35,
74.8,
51,
71,
65.7,
78.15,
49.9,
76,
82.3,
89.4,
84.05,
103.65,
103.85,
49.95,
87.95,
73.3,
79.9,
96.2,
102.95,
50.8,
70.3,
69.95,
66.4,
90.2,
79.85,
49.6,
89.8,
80.35,
69.9,
48.65,
98.7,
80,
90.85,
48.75,
79.7,
100.4,
83.55,
94.65,
70.45,
80.5,
44.75,
93.9,
50.45,
100.25,
81.7,
83.75,
98.1,
69.4,
74.15,
83.2,
73.75,
79.35,
49,
50.55,
44.15,
84.3,
92.7,
108.2,
80.05,
69.8,
95,
99.95,
103.65,
59.55,
79.65,
74.05,
65.25,
70.7,
45.25,
75.8,
74.9,
61.2,
102.8,
94.2,
88.3,
94.7,
100.65,
100.7,
45.85,
44.45,
62.05,
96.6,
104.1,
79,
60.1,
99.3,
51.55,
70.05,
78.75,
71.1,
74.9,
46,
73.75,
69.15,
93.9,
80.55,
94.9,
44.65,
84.05,
99.95,
44.55,
74.45,
55.5,
69.4,
94.45,
74.95,
93.8,
79.55,
75.1,
94.5,
85.35,
79.65,
96.8,
45.15,
73.15,
79.95,
75.35,
94.7,
106.65,
75.65,
75.3,
81.9,
72.6,
80.3,
79.6,
70.7,
73.55,
94.55,
69.05,
77.9,
101.3,
80.05,
70.45,
51.25,
49.65,
92.5,
74.45,
90.7,
90.8,
64.4,
81,
70.4,
94,
80.55,
72.15,
96.15,
107.75,
44.75,
84.65,
44.35,
84.85,
45.4,
50.75,
71.8,
46,
101.3,
48.45,
51.75,
55.7,
70.15,
69.2,
95.4,
86.55,
55.7,
83.9,
53.55,
80.5,
49.65,
90.5,
94.85,
69.95,
48.6,
80.15,
74.75,
104.05,
84.6,
69.6,
85.15,
78.1,
108.15,
80.5,
104.3,
71.35,
81,
99.85,
70.15,
105.7,
96.3,
80.05,
85.95,
79.35,
90.05,
90.8,
70.4,
71.3,
70,
70.5,
44,
100.85,
44.3,
85.2,
100.3,
50.7,
80.75,
79.15,
91.5,
80.85,
94.9,
70.75,
85.3,
97.35,
49.8,
95,
50.65,
86.85,
99.05,
55.1,
54.15,
102.25,
95.9,
44.7,
93.2,
85.8,
74.35,
44.9,
91,
95.15,
72.2,
89.55,
46.05,
76.4,
100.6,
99.05,
45.25,
83.85,
99,
77.65,
73.85,
49.9,
96.9,
74.95,
56.55,
49.25,
68.6,
74.9,
89.3,
74.3,
80.7,
92.4,
91.95,
55.1,
91.05,
69.25,
87.75,
74.15,
55,
69.95,
74.85,
76,
104.75,
79.75,
74.9,
69.8,
70.75,
80.1,
69.9,
62.05,
102.1,
74.6,
74.1,
75,
79.2,
56.5,
89.75,
78.9,
56.7,
70.15,
89.1,
90.35,
99.85,
80.3,
50.55,
103.6,
99,
91.75,
45.85,
79.55,
69,
101.9,
69.7,
105.35,
73.75,
89.85,
43.95,
45.1,
53.55,
74.45,
75.15,
107.4,
75.4,
102.6,
74.4,
99.75,
94.1,
95.65,
49.9,
104.5,
75.05,
60.4,
85.2,
70.65,
95.05,
78.7,
74.4
],
"xaxis": "x",
"y": [
2,
22,
49,
2,
1,
11,
2,
15,
8,
10,
1,
3,
7,
42,
9,
1,
7,
14,
22,
4,
15,
7,
15,
1,
8,
14,
13,
2,
8,
4,
1,
30,
1,
2,
1,
2,
19,
1,
5,
18,
1,
17,
2,
36,
4,
10,
5,
37,
25,
1,
1,
27,
33,
34,
32,
16,
1,
7,
18,
35,
1,
1,
9,
15,
12,
11,
27,
23,
10,
32,
1,
1,
4,
16,
7,
49,
43,
1,
3,
1,
10,
3,
4,
1,
3,
3,
1,
3,
4,
25,
14,
32,
30,
42,
5,
3,
15,
22,
5,
5,
2,
25,
2,
16,
7,
1,
22,
4,
50,
32,
12,
9,
15,
23,
16,
24,
3,
32,
2,
1,
1,
8,
33,
34,
4,
32,
3,
9,
3,
14,
32,
43,
3,
40,
10,
2,
23,
49,
2,
2,
7,
41,
11,
17,
16,
3,
4,
37,
32,
7,
47,
11,
11,
13,
12,
13,
6,
18,
3,
19,
24,
1,
3,
1,
2,
1,
20,
15,
2,
15,
3,
9,
10,
23,
2,
1,
4,
4,
29,
9,
12,
5,
3,
20,
4,
1,
13,
2,
1,
11,
23,
2,
1,
16,
6,
13,
9,
11,
17,
34,
11,
1,
3,
46,
8,
1,
41,
21,
2,
9,
2,
3,
35,
1,
12,
19,
1,
23,
31,
19,
1,
1,
1,
1,
1,
17,
1,
22,
47,
3,
1,
20,
49,
24,
8,
14,
25,
9,
24,
4,
5,
1,
2,
1,
21,
43,
1,
2,
18,
8,
1,
33,
3,
7,
1,
2,
7,
38,
5,
1,
3,
6,
12,
1,
8,
66,
1,
3,
5,
34,
29,
26,
35,
16,
17,
30,
3,
1,
18,
1,
32,
48,
20,
9,
40,
27,
38,
31,
8,
2,
18,
15,
1,
8,
53,
3,
4,
59,
1,
1,
24,
36,
8,
13,
8,
3,
25,
30,
1,
39,
25,
29,
1,
2,
1,
2,
15,
1,
4,
22,
4,
4,
7,
8,
1,
5,
1,
1,
1,
16,
4,
24,
3,
29,
1,
2,
67,
1,
4,
25,
22,
12,
1,
20,
1,
28,
33,
40,
12,
20,
7,
4,
5,
28,
3,
1,
1,
32,
5,
1,
10,
4,
3,
17,
1,
30,
5,
32,
16,
1,
2,
4,
5,
15,
17,
1,
2,
3,
37,
36,
22,
6,
4,
41,
1,
4,
1,
5,
10,
1,
1,
12,
4,
2,
2,
1,
18,
4,
3,
29,
1,
2,
29,
4,
1,
26,
7,
31,
42,
4,
2,
2,
9,
1,
11,
1,
1,
30,
14,
21,
8,
9,
8,
2,
25,
2,
12,
37,
24,
2,
9,
4,
13,
3,
1,
1,
16,
57,
5,
4,
1,
7,
3,
3,
27,
2,
6,
4,
12,
26,
27,
1,
2,
21,
3,
4,
1,
2,
6,
67,
1,
18,
2,
16,
1,
20,
3,
2,
1,
4,
5,
14,
2,
10,
1,
29,
3,
20,
34,
55,
21,
2,
6,
12,
5,
11,
24,
6,
3,
1,
2,
17,
31,
2,
14,
14,
7,
5,
23,
22,
49,
4,
2,
30,
6,
16,
1,
17,
1,
45,
1,
1,
12,
41,
26,
1,
42,
15,
13,
9,
1,
1,
1,
22,
17,
20,
10,
20,
33,
6,
45,
1,
3,
8,
3,
1,
4,
22,
2,
2,
25,
2,
27,
22,
56,
16,
2,
1,
1,
31,
5,
11,
1,
24,
2,
9,
5,
1,
36,
4,
7,
7,
5,
16,
41,
2,
4,
39,
1,
16,
4,
1,
8,
26,
13,
12,
7,
6,
16,
2,
20,
1,
39,
16,
1,
7,
17,
5,
15,
13,
2,
7,
34,
3,
2,
27,
5,
30,
28,
1,
13,
1,
6,
10,
1,
18,
16,
4,
5,
33,
15,
18,
10,
32,
45,
3,
1,
1,
5,
1,
1,
16,
5,
18,
1,
4,
1,
1,
7,
21,
21,
1,
3,
1,
11,
1,
22,
9,
7,
1,
29,
3,
23,
10,
3,
6,
11,
32,
6,
27,
1,
10,
21,
1,
30,
15,
17,
6,
1,
34,
9,
2,
20,
2,
17,
1,
45,
1,
47,
37,
1,
16,
11,
3,
12,
4,
1,
9,
36,
1,
36,
3,
2,
29,
2,
2,
13,
19,
6,
16,
26,
7,
1,
35,
11,
4,
43,
2,
1,
33,
54,
2,
33,
3,
9,
6,
1,
23,
38,
2,
1,
15,
2,
45,
1,
10,
26,
36,
3,
32,
6,
15,
18,
1,
5,
2,
15,
42,
2,
15,
2,
7,
5,
1,
2,
10,
3,
3,
3,
40,
4,
22,
4,
2,
13,
20,
5,
18,
32,
4,
18,
13,
9,
1,
1,
2,
37,
1,
34,
12,
3,
1,
1,
1,
3,
3,
48,
24,
9,
22,
18,
30,
8,
3,
40,
3,
4,
34,
1,
18,
19,
4
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 1",
"marker": {
"color": "#00cc96",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 2",
"showlegend": true,
"type": "scattergl",
"x": [
18.85,
19.85,
19.45,
20.55,
21,
19.3,
19.45,
19.2,
20.7,
19.75,
20.65,
19.9,
19.95
],
"xaxis": "x",
"y": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 0",
"marker": {
"color": "#00cc96",
"symbol": "square"
},
"mode": "markers",
"name": "2, 0",
"showlegend": false,
"type": "scattergl",
"x": [
20.15,
20.2,
20.2,
19.75,
20.75,
20.25,
19.25,
19.15,
19.9,
19.6,
20.4,
19.85,
19.55,
19.9,
19,
20.05,
20.45,
20.65,
19.55,
20.8,
19.9,
20.05,
19.75,
19.65,
21.1,
19.45,
20.15,
19.85,
20.35,
19.55,
20.05,
19.05,
19.5,
19.2,
20.05,
20.2,
20.9,
21.05,
20.2,
20.15,
20.45,
20.15,
19.4,
19.6,
19.75,
20.45,
20.95,
19.65,
20.5,
20.45,
19.5,
19.2,
25,
19.1,
19.8,
20.1,
20.3,
19.4,
19.5,
20.9,
19.45,
20.35,
20.5,
20.1,
20.05,
20,
19.65,
24.05,
20.4,
20.5,
19.75,
20.25,
20.2,
20.25,
19.75,
19.5,
19.75,
25.75,
19.1,
20.15,
20.25,
20.9,
19.75,
20.95,
20,
19.45,
20.25,
19.55,
20.3,
19.9,
18.9,
20.15,
19.4,
20.2,
19.65,
20.6,
19.1,
19.9,
19.65,
20.2,
20.55,
19.3,
20.2,
20.05,
19.25,
20.85,
19.65,
20.05,
20.6,
20.2,
19.95,
20.05,
19.7,
20.25,
20.3,
19.55,
20.4,
19.55,
18.85,
20.3,
20.1,
19.9,
20.35,
19.9,
19.65,
20.2,
19.3,
20.5
],
"xaxis": "x",
"y": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=4
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "4, 1",
"marker": {
"color": "#ab63fa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 4",
"showlegend": true,
"type": "scattergl",
"x": [
86.75,
105.4,
107.25,
101.9,
95.8,
96.75,
103.1,
100,
100.15,
86.45,
103.75,
90.4,
99.25,
108.3,
106.8,
107.5,
98.25,
69.95,
104.35,
99,
104.1,
95.7,
101.1,
99.85,
90.7,
106.1,
90.45,
104.05,
100.2,
105.25,
100.95,
103.45,
93.8,
104.8,
103.95,
89.05,
105.65,
111.95,
106.5,
104.15,
84.05,
90.35,
100,
106.25,
85.15,
93.8,
107.55,
99.5,
99.9,
85.9,
100.15,
106,
98.9,
102.6,
79.25,
104.65,
106.15,
103.75,
104.95
],
"xaxis": "x",
"y": [
17,
67,
56,
15,
33,
62,
47,
55,
62,
30,
62,
25,
35,
42,
56,
63,
56,
3,
60,
48,
67,
12,
46,
34,
31,
28,
28,
66,
28,
53,
19,
31,
31,
70,
61,
25,
4,
41,
52,
55,
32,
9,
43,
65,
35,
33,
43,
59,
61,
27,
55,
60,
10,
41,
32,
58,
59,
33,
72
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=4
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "4, 0",
"marker": {
"color": "#ab63fa",
"symbol": "square"
},
"mode": "markers",
"name": "4, 0",
"showlegend": false,
"type": "scattergl",
"x": [
110.5,
104.55,
74.1,
70,
98.6,
96.65,
75.85,
100.5,
90.1,
74.65,
75.3,
85.15,
79.5,
95.5,
91,
104.15,
94.05,
105.95,
89.35,
100.05
],
"xaxis": "x",
"y": [
27,
21,
1,
5,
17,
17,
12,
27,
28,
13,
13,
12,
16,
12,
20,
13,
7,
14,
19,
22
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=3
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "3, 1",
"marker": {
"color": "#FFA15A",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 3",
"showlegend": true,
"type": "scattergl",
"x": [
96.55
],
"xaxis": "x",
"y": [
24
],
"yaxis": "y"
},
{
"marker": {
"color": "grey",
"symbol": "square"
},
"mode": "markers",
"name": "Payment by electronic check",
"type": "scatter",
"y": [
null
]
},
{
"marker": {
"color": "grey",
"symbol": "x"
},
"mode": "markers",
"name": "Payment with other methods",
"type": "scatter",
"y": [
null
]
}
],
"layout": {
"legend": {
"title": {
"text": "Clusters and payment methods"
},
"tracegroupgap": 0
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "MonthlyCharges"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "tenure"
}
}
}
},
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig_eucl = px.scatter(df_clusters.rename(columns={\"cluster_eucl\": \"cluster\"}), \n",
" x=\"MonthlyCharges\", y=\"tenure\", color=\"cluster\",\n",
" symbol=\"PaymentMethod_Electronic check\",\n",
" symbol_map={0: \"square\", 1: \"x\"})\n",
"\n",
"get_distinct_legend_elements_for_cluster_and_payement(fig_eucl)\n",
"\n",
"fig_eucl.show()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:37:03.706995Z",
"start_time": "2020-12-29T15:37:03.621944Z"
}
},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 1",
"marker": {
"color": "#636efa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 1",
"showlegend": true,
"type": "scattergl",
"x": [
29.85,
70.7,
99.65,
105.5,
39.65,
30.2,
69.7,
80.65,
95.45,
94.4,
75.3,
79.35,
50.55,
74.7,
78.95,
89.85,
100.25,
74.4,
85.95,
35.45,
44.35,
71.15,
45.65,
82.4,
69.7,
104.4,
79.25,
24.8,
30.4,
91,
96.55,
79.9,
106.6,
25.25,
70.15,
73.15,
95,
75.35,
74.4,
70.4,
40.2,
41.15,
106.9,
94.45,
85.4,
55,
70,
74.5,
89.35,
95.45,
90.4,
89.05,
69.35,
80.6,
44.8,
82.9,
70.35,
73.85,
72.1,
90.4,
89.15,
41.9,
54.1,
85.65,
86.75,
44,
44.3,
81.35,
85.95,
53.45,
112.95,
94.75,
75.1,
101.15,
99.8,
55,
74.7,
96.1,
81.45,
83.55,
100.15,
74.35,
59,
74.4,
28.45,
94.1,
94.2,
80.5,
74.35,
70.05,
79.95,
85,
89.55,
70.2,
49.3,
101.9,
70.5,
89.2,
85.7,
29.95,
85.25,
89.55,
94.55,
89.5,
69.65,
34.7,
80,
49.9,
49.25,
50.15,
85.95,
45.35,
80.85,
80.45,
98.55,
90.35,
98.55,
70.3,
93.35,
82,
45.35,
52.2,
98.5,
85.35,
69.55,
78.85,
89.9,
64.35,
50.8,
73.65,
95.1,
105.1,
110.1,
83.9,
84.35,
24.6,
93.85,
100.5,
56.4,
72.85,
73.55,
75.4,
81.7,
79.4,
81.15,
84.6,
83.25,
79.05,
30.15,
75.6,
56.75,
96,
90.55,
69.9,
75.25,
86.6,
94.3,
70.3,
95.35,
90.1,
68.95,
49.5,
40.05,
84.7,
100.6,
92.1,
49.15,
70.2,
43.65,
39.5,
80,
89.25,
69.55,
80.95,
74.3,
80.55,
79.75,
35.55,
60.25,
95.15,
18.85,
80.4,
95.1,
53.8,
19.85,
101.35,
60.15,
90.45,
78.9,
74.9,
70.15,
80.25,
69,
69.55,
80.3,
75.9,
49.95,
76.95,
96.15,
45.3,
90.15,
75.8,
19.45,
79.3,
30.9,
80.15,
80.25,
89.5,
75,
44.75,
75.6,
44.05,
86.6,
85.2,
69.25,
25.2,
87.25,
79.95,
88.35,
94.75,
95.05,
78.45,
70.2,
85.6,
79.2,
69.25,
84.35,
35,
66.25,
76,
93.85,
84.3,
101.1,
74.15,
50.45,
91.4,
50.05,
100,
20.55,
85.3,
70.4,
96.85,
88.2,
75.65,
71.1,
74.7,
76.65,
84.8,
92.6,
42.6,
95.4,
75.35,
100.85,
50.3,
69.95,
80.8,
91.7,
74.95,
69.35,
95.35,
111.4,
45,
80.45,
74.7,
70.35,
88.8,
43.8,
69.95,
45.05,
79.1,
69.75,
76.85,
80.15,
34.7,
85.3,
35.65,
99.75,
73.85,
74.4,
82.75,
107.95,
94.9,
94.2,
59.85,
69.6,
45.4,
69.9,
89.95,
45.4,
90.5,
79,
91.15,
71.65,
98.7,
76.35,
75.5,
74.85,
47.95,
45.1,
45,
45.55,
35.1,
45.15,
43.3,
73.2,
83.75,
70.05,
86,
72.65,
21,
78.95,
92,
78.5,
30.5,
64.6,
81.05,
79.1,
80.75,
75.35,
75.45,
34.25,
81.1,
74.95,
93.55,
95.25,
84.75,
83.55,
45.7,
69.95,
44.6,
47.15,
80.2,
86.45,
86.25,
81,
95.7,
88.15,
74.3,
69.65,
77.4,
49.4,
48.7,
95.6,
71.35,
80.85,
33.65,
79.95,
19.3,
94.05,
70.2,
75.25,
54.35,
24.95,
75.3,
70.55,
91,
66.85,
72.9,
50.1,
80.55,
75.8,
95.25,
60.85,
86.05,
88.55,
91.3,
79.5,
86.25,
100.8,
86.3,
89.95,
76.45,
70.5,
70,
95.85,
102.45,
69.35,
80.2,
86.85,
49.85,
99.85,
74.5,
48.2,
85.65,
106.7,
25.15,
45.2,
90.25,
47.8,
69.85,
90.6,
83.05,
84,
80.35,
44.75,
82.65,
70.15,
105.3,
55.45,
59.25,
88.35,
94.2,
96.25,
70.7,
70.05,
35.9,
84.8,
74.9,
104.85,
74.45,
89.35,
77.15,
48.55,
45,
80.45,
54.45,
90.75,
75.7,
96.4,
91.45,
83.3,
100.4,
94.6,
105.3,
49.4,
76.05,
75.15,
70.1,
69.75,
34.5,
70.3,
99.25,
84.8,
90.75,
49.25,
95.15,
74.65,
79.85,
78.75,
44,
76.4,
98.7,
100.8,
51.55,
79.25,
24.5,
85.7,
89.5,
86.05,
44.55,
34.7,
70.15,
92.55,
85.35,
44.4,
80.1,
74.55,
100.95,
94.9,
97.1,
55.2,
74.4,
69.7,
98.1,
25.1,
99.6,
94.2,
50.15,
81.95,
69.35,
84.6,
91.1,
86.1,
64.9,
71,
79.7,
69.25,
74.1,
99.4,
95.5,
74.55,
69.9,
75.6,
93.85,
100.75,
100.75,
46.35,
90.4,
74.75,
84.45,
74.95,
55.3,
84.95,
79.55,
84.5,
49.9,
30.4,
44.45,
68.65,
84.4,
85.55,
77.85,
87.05,
84.8,
54.2,
19.45,
74.05,
84.45,
59.4,
70,
45.3,
76.45,
101.75,
72.75,
94.85,
49.85,
80.55,
55.25,
93.85,
29.75,
74.65,
71.95,
94.2,
29.9,
39.7,
86.65,
101.8,
24.4,
91.1,
101.35,
81.7,
79.15,
100.95,
64,
69.6,
80,
78.45,
19.2,
70.75,
84.45,
75.55,
85.65,
70.25,
75.35,
89.4,
84.05,
99.5,
59.2,
83.2,
54.9,
103.9,
55.6,
95.1,
75.5,
73.75,
96.05,
88.95,
89.5,
69.8,
94.7,
90.55,
45.9,
91.4,
91.5,
74.15,
50.7,
77.8,
51.05,
75.35,
69.3,
24.95,
84.75,
75.25,
43.3,
50.35,
74.2,
59.45,
79.6,
71.05,
85.25,
89.8,
50.75,
80.5,
86.25,
45.65,
40.75,
55.35,
46.3,
73.7,
48.35,
49.55,
71.25,
69.7,
25.25,
45.15,
75.1,
45.8,
69.1,
71.15,
49.15,
79.15,
78.5,
102,
96.6,
69.8,
84.05,
71.65,
49.35,
94.25,
68.95,
93.85,
76.05,
49,
80.35,
55.8,
79.05,
95,
84.05,
89.8,
69.1,
81.45,
49.1,
85.45,
79.85,
71.65,
73.55,
44.55,
74.25,
74.2,
100.2,
105.65,
73.9,
45.45,
102.55,
103.1,
43.75,
45.75,
79.8,
88.85,
74.95,
74.95,
78.8,
69.1,
90.2,
78.55,
78.65,
42.9,
44,
74.4,
94.8,
105.3,
57.55,
84.55,
24.45,
85.2,
24.25,
76.5,
38.5,
92.9,
93.5,
69.6,
50.55,
100.55,
24.45,
94.1,
51.35,
50.6,
70.5,
94.85,
50.15,
38.9,
79.55,
95.8,
69.6,
78.05,
73.6,
74.75,
74,
44.75,
25.05,
94.95,
23.9,
85.45,
89,
74.9,
101.25,
86.55,
24.35,
20.7,
85.55,
90.6,
90.05,
75.1,
75.85,
68.5,
73.5,
70.05,
94,
70.2,
88.05,
91.85,
40.1,
79.55,
70.15,
89.1,
51.1,
94.4,
78.25,
76.4,
84.95,
44.15,
75.75,
80.3,
74.9,
50.35,
79.85,
80.85,
24.75,
25.1,
24.7,
89.15,
24.75,
69.8,
75.65,
90.7,
78.5,
79.9,
98.5,
78.2,
88.45,
69.85,
79.9,
54.2,
74.9,
70.35,
84.3,
70.1,
78.3,
94.4,
84.3,
99.55,
81.25,
75.3,
99.25,
79.75,
69.35,
85.8,
80.55,
84.5,
67.75,
90.35,
85.05,
94.75,
49.45,
94.7,
92.5,
75.55,
70,
70.3,
86.2,
74.9,
99.85,
83.85,
78.85,
61.15,
78.95,
74.35,
84.6,
94.65,
76.5,
49.2,
80.85,
78.95,
45.15,
79.4,
68.95,
96.8,
80.65,
94,
89.85,
53.95,
105.5,
81,
69.8,
94.6,
54.55,
70.4,
70.95,
48.8,
104.4,
29.4,
65.6,
84.35,
25.25,
74.7,
90.8,
79.55,
35.75,
46,
103.45,
89.4,
50.9,
81,
91.65,
100.2,
90.85,
47.95,
63.6,
44.1,
50.75,
96.05,
44.7,
74.35,
95.6,
70.3,
69.8,
85.55,
101.5,
89.15,
78.8,
79.6,
90.6,
104.6,
75.85,
35.2,
75.35,
95.7,
54.4,
77,
75.3,
73.5,
70.4,
94,
30.45,
80.2,
19.75,
89.25,
30.75,
86.2,
104.2,
76.25,
74.35,
53.65,
69.65,
80.8,
44.8,
69.35,
36.45,
54.3,
84.9,
92.55,
96.2,
98.75,
101.15,
81.15,
88.7,
79.75,
94.55,
90.1,
53.75,
89.3,
95.2,
45.7,
74.5,
79.65,
83.65,
90.1,
45.6,
88.35,
89.35,
29.65,
84.5,
70.3,
74.75,
50.8,
61.3,
80.25,
30.5,
99.45,
70.6,
84.85,
24.8,
80.85,
89.45,
76.4,
54.5,
79.9,
69.55,
31.05,
88.85,
79.7,
84.6,
69.05,
73.65,
25.2,
84.35,
84.95,
73.85,
46,
79.4,
80.35,
81.1,
78.85,
89.45,
97.9,
79.8,
80.2,
31.65,
20.65,
39.05,
69.85,
88.45,
70.8,
75.5,
74.85,
96.65,
19.9,
46.35,
19.95,
79.6,
75.9,
76.2,
48.6,
79,
49.75,
94.75,
70.25,
60,
86.55,
35,
74.65,
85.3,
86.85,
75.7,
45.55,
90.8,
97.95,
55.3,
89.4,
87.3,
99.95,
70.15,
96.5,
91.55,
70.25,
69.65,
89.3,
74.8,
25.15,
85.2,
35.1,
81.3,
85.45,
71,
85.05,
44.6,
44.4,
70.3,
70.45,
51.4,
75.4,
78.75,
75.8,
76.1,
69.1,
88.25,
69.65,
75.4,
100.6,
86,
29.6,
41.6,
85,
78.95,
89.25,
98,
94.45,
105,
84,
48.75,
84.85,
24.7,
78.55,
89.15,
89.75,
85.15,
94.6,
94.25,
74.95,
89.75,
82.85,
83.6,
74.55,
56.15,
76.6,
55,
87.1,
94.95,
44.55,
23.45,
55.4,
90.6,
70.2,
78.1,
90,
71,
89.1,
70.65,
79.25,
70.1,
29.65,
54.3,
80.5,
74.7,
80.7,
85.75,
50.75,
98.25,
69,
100.5,
69.95,
93.3,
49.15,
74.5,
73,
70.1,
70.65,
79.45,
75.55,
95,
70.35,
95.85,
79.15,
79,
75.85,
91.85,
69.65,
100.35,
98.9,
74.85,
101.95,
94,
84.05,
101.7,
70.1,
50.5,
74.4,
90.65,
49.15,
95.65,
75.05,
94.4,
101.45,
97,
69.5,
69.2,
69.65,
82.3,
79.25,
84.6,
25.05,
48.95,
54.85,
45.3,
85.85,
95.2,
79.85,
74.65,
56.25,
68.65,
73.8,
100.2,
99.7,
90.1,
70.85,
94.1,
44.5,
25.3,
80.8,
76.45,
91.3,
95.75,
78.75,
74.5,
50.15,
86.5,
69.15,
54.65,
79.55,
43.95,
29.15,
91.05,
79.2,
96.55,
85.6,
45.25,
74.3,
100.75,
89.2,
70.75,
45.3,
55.9,
96,
85,
49.4,
69.2,
29.9,
69.65,
39.65,
74.95,
29.7,
50.35,
70.3,
86.8,
84.2,
79.7,
100.75,
91.65,
88.85,
25.3,
95.45,
91.1,
89.5,
35.15,
101.35,
80.7,
29.05,
105.9,
55.35,
85.5,
69.35,
69.6,
80.15,
82,
45.05,
86.25,
101.25,
74.35,
80.5,
74.45,
49.95,
44.4,
75.75,
29.6
],
"xaxis": "x",
"y": [
1,
2,
8,
25,
1,
1,
5,
2,
18,
9,
3,
1,
11,
1,
12,
3,
10,
3,
13,
1,
2,
8,
1,
20,
2,
2,
13,
1,
3,
6,
20,
1,
19,
1,
4,
18,
11,
4,
15,
2,
1,
3,
13,
16,
5,
14,
1,
8,
6,
4,
4,
22,
5,
5,
1,
11,
2,
7,
1,
2,
7,
21,
16,
2,
17,
1,
2,
3,
10,
2,
16,
8,
1,
4,
7,
1,
1,
5,
20,
8,
15,
1,
2,
2,
5,
20,
2,
6,
5,
5,
2,
1,
12,
11,
1,
15,
9,
4,
1,
9,
10,
1,
20,
2,
2,
2,
1,
1,
2,
3,
4,
3,
5,
2,
10,
2,
20,
3,
15,
2,
2,
1,
10,
6,
1,
4,
1,
5,
1,
20,
3,
15,
10,
6,
7,
1,
17,
9,
4,
10,
1,
16,
22,
3,
13,
4,
4,
6,
13,
8,
4,
2,
1,
1,
11,
1,
4,
2,
7,
18,
2,
1,
4,
5,
8,
8,
13,
14,
12,
5,
5,
24,
3,
2,
13,
1,
9,
1,
3,
2,
1,
3,
23,
5,
1,
15,
1,
7,
17,
1,
3,
1,
17,
7,
3,
2,
16,
3,
16,
1,
11,
1,
1,
7,
2,
2,
4,
7,
8,
6,
5,
11,
16,
18,
1,
1,
14,
10,
18,
9,
13,
4,
4,
10,
1,
22,
24,
18,
8,
1,
2,
15,
15,
12,
1,
2,
1,
16,
1,
5,
4,
13,
19,
15,
18,
1,
17,
14,
17,
2,
3,
14,
8,
4,
5,
6,
1,
1,
4,
10,
11,
3,
12,
2,
2,
1,
1,
3,
17,
1,
5,
9,
4,
1,
3,
11,
1,
3,
4,
5,
3,
3,
17,
1,
1,
9,
1,
14,
2,
13,
2,
2,
1,
10,
1,
1,
8,
1,
1,
1,
10,
2,
1,
1,
19,
3,
1,
2,
16,
1,
5,
3,
7,
5,
3,
1,
3,
2,
1,
1,
5,
7,
11,
1,
10,
16,
17,
1,
1,
2,
5,
2,
10,
16,
5,
12,
15,
1,
16,
3,
2,
7,
1,
1,
17,
4,
1,
1,
9,
11,
3,
1,
5,
1,
1,
15,
7,
11,
1,
2,
2,
13,
2,
4,
2,
1,
1,
7,
1,
14,
20,
17,
4,
10,
1,
1,
11,
2,
3,
1,
23,
1,
7,
4,
12,
1,
1,
8,
2,
3,
11,
15,
5,
3,
1,
14,
1,
5,
1,
8,
1,
8,
5,
2,
1,
1,
7,
7,
14,
4,
5,
1,
4,
2,
14,
13,
6,
2,
16,
2,
9,
7,
1,
12,
8,
3,
7,
1,
1,
7,
10,
7,
1,
1,
2,
19,
4,
19,
5,
1,
2,
3,
13,
15,
10,
2,
2,
5,
1,
4,
10,
13,
17,
9,
7,
4,
9,
3,
10,
2,
4,
1,
8,
12,
3,
4,
11,
1,
1,
7,
12,
6,
14,
11,
1,
1,
1,
6,
18,
9,
11,
1,
9,
7,
27,
22,
14,
3,
2,
12,
14,
3,
16,
1,
1,
1,
2,
2,
21,
6,
2,
4,
8,
11,
5,
1,
9,
13,
16,
17,
1,
14,
15,
4,
3,
8,
9,
1,
1,
3,
7,
13,
12,
4,
19,
10,
17,
1,
10,
12,
1,
4,
19,
5,
1,
3,
1,
1,
2,
9,
1,
4,
1,
7,
12,
2,
11,
1,
13,
1,
21,
11,
1,
6,
4,
12,
4,
10,
1,
18,
1,
4,
5,
15,
18,
4,
18,
8,
1,
2,
9,
19,
8,
3,
5,
2,
15,
1,
7,
20,
5,
1,
3,
2,
1,
9,
3,
1,
21,
18,
1,
1,
8,
1,
9,
1,
1,
1,
1,
6,
20,
11,
11,
3,
2,
2,
2,
4,
7,
1,
2,
4,
15,
4,
1,
1,
1,
12,
10,
6,
12,
15,
18,
10,
1,
18,
1,
3,
1,
4,
4,
4,
8,
17,
9,
9,
1,
12,
18,
3,
11,
1,
1,
20,
2,
1,
1,
1,
6,
17,
6,
3,
7,
4,
8,
1,
11,
8,
14,
4,
2,
1,
14,
20,
7,
5,
3,
1,
10,
1,
16,
9,
14,
1,
1,
7,
9,
1,
7,
2,
19,
13,
1,
7,
6,
15,
12,
2,
1,
5,
1,
4,
14,
3,
1,
11,
5,
8,
4,
9,
3,
1,
1,
2,
1,
15,
17,
19,
11,
18,
2,
8,
1,
1,
6,
24,
9,
3,
1,
7,
17,
1,
18,
4,
16,
3,
3,
10,
18,
16,
1,
4,
3,
7,
1,
3,
1,
12,
17,
1,
11,
8,
10,
23,
15,
1,
3,
1,
12,
2,
9,
1,
4,
6,
8,
5,
2,
1,
2,
15,
4,
10,
9,
24,
1,
6,
1,
12,
15,
2,
5,
4,
1,
2,
3,
5,
19,
18,
1,
15,
1,
8,
16,
1,
24,
9,
3,
2,
7,
10,
8,
4,
20,
3,
1,
5,
2,
1,
4,
15,
17,
4,
4,
4,
2,
1,
6,
3,
1,
14,
18,
2,
11,
14,
1,
6,
10,
9,
12,
20,
2,
19,
22,
9,
18,
4,
15,
8,
3,
1,
8,
1,
11,
8,
15,
1,
1,
3,
11,
17,
9,
1,
7,
1,
9,
4,
3,
1,
1,
8,
17,
7,
16,
8,
9,
20,
2,
12,
6,
11,
6,
3,
5,
8,
1,
19,
1,
1,
13,
1,
10,
5,
3,
10,
1,
4,
2,
4,
12,
1,
6,
1,
13,
9,
2,
1,
9,
1,
13,
10,
7,
1,
9,
1,
11,
6,
8,
11,
1,
15,
21,
1,
14,
3,
3,
13,
5,
13,
1,
18,
1,
4,
17,
3,
7,
13,
1,
14,
1,
1,
1,
1,
1,
7,
1,
18,
1,
1,
8,
1,
5,
15,
19,
1,
2,
20,
4,
2,
13,
19,
19,
13,
15,
16,
3,
1,
1,
18,
4,
5,
13,
5,
17,
1,
9,
3,
1,
1,
20,
2,
7,
13,
3,
3,
21,
17,
1,
18,
10,
1,
3,
11,
1,
14,
6,
13,
5,
3,
8,
9,
1,
1,
18,
5,
7,
14,
3,
16,
2,
6,
6,
5,
3,
5,
12,
6,
8,
2,
12,
1,
1,
1,
1,
14,
23,
9,
19,
4,
1,
10,
4,
4,
1,
18,
5,
5,
15,
6,
7,
5,
1,
1,
3,
3,
1,
1,
2,
2,
5,
26,
2,
2,
1,
4,
9,
17,
14,
13,
10,
9,
7,
2,
13,
4,
2,
1,
1,
4,
6,
2,
10,
1,
1,
13,
1,
1,
1,
1,
3,
13,
1,
1,
6,
1,
2,
10,
2,
9,
1,
1,
9,
14,
15,
9,
1,
13,
2,
1,
1,
1,
12,
6,
16,
1,
16,
7,
1,
1,
9,
2,
13,
3,
2,
5,
18,
2,
14,
13,
11,
2,
13,
4,
12,
1,
4,
1,
3,
3,
19,
4,
15,
1,
1,
7,
6,
6,
11,
14,
4,
3,
1,
13,
6,
3,
8,
3,
4,
3,
9,
9,
1,
1,
5,
13,
12,
9,
27,
4,
13,
1,
1,
6,
1,
11
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 0",
"marker": {
"color": "#636efa",
"symbol": "square"
},
"mode": "markers",
"name": "1, 0",
"showlegend": false,
"type": "scattergl",
"x": [
53.85,
20.15,
95.5,
20.2,
45.25,
97.85,
49.25,
99.1,
80.65,
79.85,
49.05,
64.5,
75.15,
99.3,
20.2,
24.3,
19.75,
70.45,
95,
80.9,
70.9,
74.45,
76.45,
105.35,
29.95,
45.3,
84.5,
20.75,
80.05,
78.3,
46,
80,
50.05,
55.2,
84.6,
54.4,
48.55,
44.6,
24.8,
70.6,
50.55,
95.15,
20.25,
73.6,
19.25,
82.65,
80.6,
84.8,
80.25,
96.5,
19.15,
25.35,
50.65,
90.85,
19.9,
19.6,
73.25,
75.3,
69.85,
75.6,
55.05,
69.55,
70.05,
69,
20.4,
99.7,
78,
19.85,
19.55,
86.05,
19.9,
75.3,
19,
45.6,
65.55,
74.55,
25.25,
78.55,
34.55,
45.7,
69.55,
74.6,
95.1,
24.25,
20.05,
74.75,
45.65,
75.05,
107.95,
64.4,
71.1,
20.45,
75.1,
20.65,
49.25,
19.55,
86,
44.05,
75.05,
85.9,
20.8,
35.8,
19.9,
88.9,
40.3,
44.8,
45,
64.2,
86.2,
89.45,
95.6,
44.4,
80.6,
34.8,
20.05,
98.9,
98.3,
89,
104.55,
75.1,
74.4,
44.95,
44.7,
45.7,
100.3,
19.75,
69.55,
50.15,
95.9,
88.3,
90.45,
50.25,
19.65,
84.7,
89.55,
69.75,
49.05,
98.05,
21.1,
89.7,
100.45,
74.75,
56.15,
94.4,
74.65,
104.05,
75.2,
96.65,
31.35,
89.75,
80,
109.9,
87.9,
85.7,
86,
24.6,
45.85,
58.7,
45.05,
50.3,
62.8,
74.1,
80.7,
85.6,
19.45,
25.15,
45,
75.35,
20.15,
54.7,
75.2,
70.15,
19.85,
70,
70.7,
49.95,
20.35,
82.85,
99.8,
84.4,
99.95,
75.55,
55.8,
80.8,
74.6,
74.4,
55.05,
51.25,
19.55,
79.5,
25.8,
90,
45.85,
95.6,
20.05,
98.6,
48.95,
89.05,
29.05,
75.75,
75.9,
85.35,
79.5,
85.8,
44.3,
74.6,
50.15,
83.8,
74.25,
19.05,
19.5,
87.15,
84.75,
48.75,
78.1,
89.65,
43.85,
96.65,
19.2,
73.85,
20.05,
46.2,
45.95,
44.05,
45.55,
45.1,
50.95,
90.95,
50.9,
20.2,
20.9,
21.05,
54.65,
49.8,
25.5,
70.7,
90.9,
75.5,
87.1,
75.9,
45.3,
60.95,
25.05,
20.2,
70.6,
24.7,
20.15,
69.75,
90.75,
80.55,
85.2,
20.45,
75.85,
44.45,
20.15,
50.5,
74.4,
43.95,
50.2,
70.1,
71.45,
51.2,
80.1,
98.15,
112.95,
70.9,
100.15,
71.55,
55.9,
85.3,
48.75,
85.05,
70.4,
46.1,
45.95,
85.55,
29.65,
90.7,
30.25,
49.85,
93,
38.55,
24.45,
103.35,
81.5,
90,
74.2,
70.45,
85.65,
35.25,
86.05,
44.55,
74.25,
69.5,
19.4,
80.1,
98.15,
69.95,
45.45,
54.75,
80.2,
19.6,
80.55,
83.4,
70.7,
84.35,
55.55,
89.6,
19.75,
70.05,
50.4,
79.65,
80.45,
50.1,
20.45,
94.85,
55.3,
44.4,
95.65,
41.35,
20.95,
19.65,
74.3,
74.65,
98.1,
88.35,
50.15,
20.5,
48.25,
62.15,
44.6,
63.75,
79.95,
45.05,
20.45,
73.5,
83.8,
75.45,
80.3,
31,
70.25,
60.65,
19.5,
19.2,
33.9,
25.25,
89.15,
25,
43.25,
45.4,
85.4,
45.8,
75.75,
68.65,
24.3,
105.35,
53.5,
25.1,
19.1,
75.15,
69.95,
74.3,
29.85,
95.1,
19.8,
76.65,
99.15,
75.1,
81.5,
36.45,
25.05,
50.45,
44.9,
29.8,
20.1,
55.15,
70.55,
100.85,
35,
50.95,
69.1,
77.95,
20.3,
46.3,
83.15,
74.15,
44.15,
85.45,
85.05,
50.85,
75.45,
54.85,
19.4,
70.6,
84.3,
50.7,
53.4,
50.6,
71.3,
61.45,
44.95,
19.5,
85.2,
45.3,
73.25,
29.2,
46.6,
85.35,
20.9,
44.9,
19.45,
84.8,
74.6,
79.15,
89.65,
20.35,
75,
40,
99.45,
70.1,
70.2,
45.85,
100.15,
24.4,
50.15,
88.4,
50.8,
20.5,
30.55,
20.1,
75,
69.15,
50.75,
70.8,
50.6,
58.5,
29.15,
20.05,
24.45,
49.55,
89.35,
73.6,
25.2,
50.4,
20,
54.45,
94.05,
55.3,
74.75,
70.85,
49.2,
19.65,
74.05,
101.55,
44.8,
80.15,
29.9,
35.2,
69.95,
93.55,
80.85,
95.95,
50.95,
34.25,
73.85,
29.25,
69.95,
85.8,
90.7,
24.05,
20.4,
54.35,
45.35,
20.5,
25.05,
74.8,
51,
71,
65.7,
19.75,
78.15,
49.9,
20.25,
82.3,
20.2,
20.25,
19.75,
49.95,
87.95,
19.5,
73.3,
33.6,
79.9,
96.2,
50.8,
70.3,
69.95,
19.75,
75.3,
66.4,
90.2,
25.75,
49.6,
89.8,
85.15,
40.1,
80.35,
69.9,
45.4,
48.65,
19.1,
20.15,
48.75,
79.7,
20.25,
83.55,
94.65,
70.45,
79.5,
80.5,
44.75,
50.45,
100.25,
81.7,
20.9,
69.4,
19.75,
83.2,
73.75,
79.35,
49,
20.95,
50.55,
44.15,
80.05,
20,
69.8,
99.95,
35.1,
59.55,
79.65,
74.05,
19.45,
24.4,
65.25,
70.7,
45.25,
74.9,
61.2,
94.2,
100.7,
45.85,
44.45,
20.25,
62.05,
104.1,
79,
60.1,
51.55,
70.05,
78.75,
19.55,
71.1,
20.3,
46,
19.9,
73.75,
69.15,
93.9,
80.55,
44.65,
84.05,
44.55,
57.2,
18.9,
74.45,
55.5,
51,
69.4,
94.45,
20.15,
24.35,
93.8,
36.85,
79.55,
75.1,
94.5,
19.4,
85.35,
79.65,
45.15,
20.2,
79.95,
40.4,
75.35,
94.7,
30.5,
75.65,
75.3,
81.9,
72.6,
19.65,
80.3,
70.7,
73.55,
20.6,
69.05,
80.05,
70.45,
51.25,
49.65,
92.5,
19.1,
74.45,
95.5,
90.7,
90.8,
64.4,
19.9,
81,
94,
80.55,
72.15,
19.65,
44.75,
84.65,
44.35,
84.85,
45.4,
50.75,
71.8,
20.2,
46,
101.3,
48.45,
51.75,
55.7,
70.15,
69.2,
34.7,
20.55,
42.4,
55.7,
83.9,
53.55,
80.5,
19.3,
49.65,
94.85,
69.95,
48.6,
20.2,
91,
74.75,
20.05,
25,
19.25,
84.6,
69.6,
20.85,
85.15,
19.65,
78.1,
80.5,
71.35,
20.05,
20.6,
81,
70.15,
96.3,
80.05,
85.95,
79.35,
90.8,
70.4,
71.3,
70,
70.5,
44,
44.3,
20.2,
50.7,
35.9,
80.75,
25.2,
79.15,
24.9,
91.5,
80.85,
94.9,
70.75,
40.15,
85.3,
45.3,
29.7,
49.8,
50.65,
86.85,
55.1,
19.95,
54.15,
102.25,
95.9,
24.9,
44.7,
25.85,
93.2,
74.35,
44.9,
95.15,
104.15,
72.2,
25.7,
46.05,
20.05,
76.4,
35.05,
45.25,
99,
19.7,
77.65,
73.85,
20.25,
49.9,
56.55,
49.25,
68.6,
20.3,
74.9,
74.3,
44.65,
80.7,
19.55,
20.4,
55.1,
69.25,
19.55,
87.75,
74.15,
55,
69.95,
18.85,
20.3,
74.85,
24.4,
76,
79.75,
74.9,
29.15,
69.8,
70.75,
29.7,
20.1,
80.1,
69.9,
62.05,
94.05,
102.1,
74.6,
19.9,
74.1,
75,
20.35,
56.5,
19.9,
78.9,
19.65,
20.2,
56.7,
70.15,
105.95,
89.35,
90.35,
50.55,
99,
19.3,
91.75,
45.85,
79.55,
69,
69.7,
73.75,
89.85,
43.95,
100.05,
45.1,
53.55,
74.45,
75.15,
30.5,
102.6,
20.5,
24.2,
39,
95.65,
35.45,
49.9,
75.05,
60.4,
70.65,
78.7,
74.4
],
"xaxis": "x",
"y": [
2,
1,
2,
1,
1,
11,
2,
15,
8,
10,
1,
3,
7,
9,
1,
5,
1,
1,
7,
14,
4,
15,
7,
15,
1,
1,
8,
1,
14,
13,
2,
8,
4,
1,
1,
2,
1,
2,
1,
1,
5,
18,
1,
1,
1,
17,
2,
4,
10,
5,
1,
1,
1,
1,
1,
1,
16,
1,
7,
18,
1,
1,
9,
15,
1,
12,
11,
1,
1,
10,
1,
1,
1,
1,
4,
16,
8,
7,
10,
1,
3,
1,
10,
4,
1,
3,
4,
1,
3,
3,
1,
1,
3,
1,
4,
1,
14,
5,
3,
15,
1,
11,
1,
5,
3,
5,
6,
2,
2,
16,
7,
1,
4,
3,
1,
12,
9,
15,
21,
16,
3,
2,
1,
1,
8,
1,
4,
3,
9,
3,
14,
3,
1,
10,
2,
2,
2,
7,
1,
11,
17,
16,
3,
4,
7,
11,
11,
13,
1,
12,
13,
6,
18,
3,
19,
9,
1,
3,
1,
2,
1,
1,
20,
15,
1,
1,
2,
15,
1,
3,
9,
10,
1,
5,
2,
1,
1,
4,
4,
9,
12,
5,
3,
4,
1,
13,
2,
1,
1,
11,
1,
2,
1,
16,
1,
17,
6,
13,
2,
9,
11,
17,
11,
1,
3,
8,
1,
2,
9,
1,
1,
2,
3,
1,
12,
19,
1,
17,
1,
19,
1,
1,
1,
1,
1,
1,
4,
17,
1,
1,
1,
1,
3,
1,
8,
8,
14,
9,
4,
5,
1,
2,
5,
1,
1,
1,
1,
1,
2,
18,
8,
1,
12,
1,
1,
3,
7,
1,
2,
7,
5,
1,
3,
6,
12,
1,
8,
1,
3,
5,
13,
16,
17,
3,
1,
1,
3,
20,
2,
12,
9,
4,
2,
8,
2,
18,
15,
1,
8,
1,
3,
4,
1,
1,
1,
8,
13,
8,
3,
1,
1,
1,
2,
1,
2,
15,
1,
4,
1,
4,
4,
7,
8,
1,
1,
5,
1,
1,
1,
3,
1,
1,
16,
13,
4,
3,
1,
1,
4,
2,
1,
4,
12,
1,
1,
1,
12,
7,
4,
3,
5,
3,
1,
1,
10,
1,
1,
1,
5,
1,
5,
1,
10,
4,
2,
3,
1,
1,
1,
5,
16,
1,
2,
2,
1,
4,
5,
15,
17,
3,
1,
1,
2,
3,
1,
3,
6,
4,
4,
5,
1,
4,
1,
1,
5,
10,
1,
1,
12,
4,
2,
2,
1,
1,
18,
4,
3,
1,
2,
4,
1,
1,
7,
4,
2,
3,
2,
9,
1,
1,
1,
11,
1,
1,
14,
1,
8,
5,
9,
8,
2,
2,
12,
2,
2,
9,
4,
1,
1,
1,
13,
3,
1,
1,
5,
4,
1,
1,
1,
1,
7,
3,
1,
3,
1,
2,
6,
4,
12,
1,
2,
1,
21,
3,
4,
1,
1,
3,
2,
6,
1,
18,
2,
3,
16,
8,
1,
20,
3,
1,
1,
2,
1,
1,
7,
4,
5,
14,
2,
1,
10,
1,
1,
3,
1,
1,
1,
2,
6,
1,
12,
1,
5,
11,
6,
3,
1,
1,
13,
2,
17,
1,
2,
14,
12,
7,
14,
7,
5,
5,
1,
1,
4,
2,
1,
6,
16,
1,
16,
17,
1,
1,
1,
12,
1,
1,
1,
15,
13,
9,
1,
1,
1,
1,
10,
1,
20,
6,
3,
1,
3,
8,
1,
1,
3,
1,
4,
2,
2,
2,
16,
2,
1,
1,
1,
5,
11,
1,
2,
9,
5,
1,
1,
1,
4,
1,
7,
7,
5,
16,
2,
4,
1,
4,
1,
16,
4,
5,
1,
8,
1,
7,
13,
3,
12,
7,
6,
1,
16,
2,
1,
1,
16,
2,
1,
7,
6,
5,
15,
13,
2,
1,
7,
3,
2,
1,
5,
1,
13,
1,
6,
10,
1,
1,
12,
18,
16,
4,
1,
5,
15,
18,
10,
1,
3,
1,
1,
5,
1,
1,
16,
1,
5,
18,
1,
4,
1,
1,
7,
9,
1,
4,
1,
3,
1,
11,
1,
1,
9,
7,
1,
1,
20,
3,
1,
3,
1,
10,
3,
1,
6,
1,
11,
6,
1,
1,
1,
10,
1,
15,
17,
6,
1,
9,
2,
20,
2,
17,
1,
1,
1,
1,
1,
16,
4,
11,
1,
3,
12,
4,
1,
3,
9,
1,
1,
1,
3,
2,
2,
1,
2,
13,
19,
2,
6,
1,
16,
7,
1,
11,
13,
4,
1,
2,
1,
1,
1,
2,
3,
1,
9,
6,
1,
1,
2,
1,
15,
1,
2,
1,
1,
10,
1,
1,
3,
6,
1,
15,
18,
1,
5,
1,
1,
2,
1,
15,
2,
15,
4,
2,
7,
3,
1,
5,
1,
2,
7,
10,
3,
1,
3,
3,
1,
4,
1,
4,
1,
1,
2,
13,
14,
19,
5,
4,
13,
1,
9,
1,
1,
2,
1,
12,
3,
1,
22,
1,
1,
3,
3,
1,
9,
1,
1,
16,
8,
3,
3,
3,
4,
1,
19,
4
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=4
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "4, 1",
"marker": {
"color": "#EF553B",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 4",
"showlegend": true,
"type": "scattergl",
"x": [
104.8,
90.05,
99.35,
106.35,
84.5,
90.25,
100.5,
98.5,
96.75,
91.65,
76.5,
78.05,
86.8,
89.85,
107.05,
105.05,
76.1,
100.8,
74.9,
101.15,
93.15,
85.45,
95.05,
74.95,
83.3,
80.4,
81.05,
104.15,
80.25,
100.05,
100.25,
110.85,
94.55,
95.15,
84.25,
83.15,
84.9,
94.5,
87.25,
75.5,
89.25,
74.25,
95.8,
101.3,
111.2,
103.1,
88.8,
80.7,
86.45,
99.05,
95.1,
86.1,
75.5,
86.1,
83.75,
79.45,
90.6,
98.85,
90.4,
105.65,
100.4,
94.3,
99.25,
78.3,
90.45,
105.15,
107.5,
97.65,
109.55,
82.15,
94.25,
85.8,
95.5,
73.85,
94.5,
108.3,
98.75,
104.7,
96.7,
85.9,
90.25,
94.75,
86.45,
90.05,
102.6,
90.35,
84.65,
94.65,
78.9,
70.55,
110.75,
113.2,
79.15,
85,
85.3,
96,
90.05,
85.35,
99,
99.8,
85.6,
90.7,
74.95,
98.75,
90.8,
79.35,
103.85,
92.95,
85.35,
101.05,
93.2,
93.35,
80.15,
80.45,
101.1,
84.1,
74.6,
85,
98.5,
85.15,
99.85,
89.95,
91.55,
104.15,
94.25,
70.3,
90.7,
99.95,
106.1,
106.35,
100.7,
90.45,
89.7,
98.9,
101.3,
104.35,
110.45,
85.3,
83.35,
90.35,
91,
96.35,
104.9,
98.7,
85.75,
85.1,
93.5,
99.8,
99,
85.95,
90,
79.5,
74.4,
89.2,
71.05,
69.3,
106.4,
100.05,
95.4,
99.55,
90.7,
101.4,
100.2,
95.9,
89.85,
104.3,
80,
80.25,
83.8,
78.45,
87.45,
70.75,
68.25,
105.1,
84.9,
95.45,
103.45,
94.75,
97.8,
106.3,
93.8,
101.9,
94.3,
101.05,
91.15,
83.45,
75.2,
84.85,
95.05,
93.8,
95.7,
96.2,
80.5,
79.5,
81.2,
84.2,
75.25,
105.75,
95.9,
104.1,
111.5,
101.75,
101,
98.85,
89.6,
80.4,
99.65,
106.5,
98.4,
101.4,
91.25,
100.3,
104.65,
101,
89.05,
96.5,
100.2,
111.95,
100.65,
109.1,
106.4,
96.2,
105.7,
99.75,
84.85,
74,
93.55,
95.55,
80.5,
84.8,
75.2,
98.65,
103.3,
84.75,
88.75,
84.45,
104.45,
90.95,
73.9,
96.55,
69.75,
101.25,
84.05,
89.45,
86.5,
89.55,
103.3,
99.7,
94.65,
94.2,
96.8,
80.6,
100.05,
85.25,
105.35,
81.15,
102.8,
79.5,
93.6,
104.4,
100.25,
100,
94.1,
104.35,
84.9,
100.45,
91.25,
84.85,
99.8,
90,
83.05,
76.25,
91.15,
100.85,
99.5,
85.7,
107.55,
106.15,
90.85,
98.35,
84.3,
95.7,
94.5,
99.15,
82.35,
85.15,
104.45,
92.15,
93.8,
83.4,
99.7,
96.1,
104.25,
94.55,
84.1,
104.4,
101.5,
103.95,
89.4,
80.35,
107.55,
76.05,
101.1,
90.65,
89.2,
85.45,
89.8,
98.65,
104.95,
78.9,
84.75,
89.15,
100.45,
74.2,
77.75,
94.4,
95.15,
84.95,
83.75,
103.45,
84.3,
93,
95.25,
101.25,
104.4,
79.3,
89.2,
87.55,
106.4,
75.55,
70.55,
97.35,
95.6,
84.5,
78.8,
93.85,
108.9,
89.9,
99.45,
94.7,
105.2,
103.85,
88.95,
94.45,
95.05,
104.2,
99.5,
91.05,
104.2,
77.85,
85,
85.9,
93.5,
83.95,
74.3,
104.1,
94.4,
102.6,
73.1,
77.5,
79.25,
101.35,
100.05,
101.85,
103.05,
94.2,
105.8,
106.1,
100,
105,
101.4,
81.45,
103.65,
99.05,
98.35,
85.45,
89.55,
100.1,
79.9,
92.5,
109.95,
98.8,
81.3,
89.1,
86.05,
103,
103.75,
73.85,
95.55,
89.5,
93.6,
88.05,
76.1,
81,
89.2
],
"xaxis": "x",
"y": [
28,
21,
47,
34,
49,
43,
47,
25,
55,
43,
37,
27,
23,
57,
20,
52,
24,
35,
32,
38,
24,
55,
42,
29,
22,
36,
28,
24,
24,
34,
35,
28,
35,
25,
23,
35,
29,
33,
45,
25,
22,
41,
33,
40,
21,
47,
37,
26,
30,
35,
22,
32,
27,
45,
26,
38,
23,
46,
25,
39,
32,
43,
35,
34,
23,
45,
30,
34,
47,
61,
34,
29,
35,
44,
31,
42,
24,
41,
22,
25,
30,
23,
35,
30,
38,
37,
42,
51,
29,
27,
52,
41,
23,
32,
32,
24,
54,
52,
48,
49,
23,
31,
23,
47,
26,
22,
48,
37,
34,
56,
32,
33,
22,
31,
46,
21,
25,
30,
29,
30,
34,
28,
40,
44,
21,
35,
31,
31,
28,
47,
46,
28,
25,
31,
30,
31,
33,
47,
33,
24,
28,
34,
32,
49,
26,
22,
32,
41,
51,
24,
37,
27,
32,
44,
50,
25,
23,
37,
36,
38,
39,
31,
28,
25,
34,
54,
40,
41,
23,
31,
34,
29,
33,
34,
40,
35,
31,
38,
51,
41,
31,
53,
21,
24,
37,
38,
43,
43,
50,
31,
50,
32,
26,
32,
40,
51,
39,
26,
29,
30,
44,
42,
46,
32,
32,
46,
57,
41,
41,
35,
26,
42,
24,
43,
25,
36,
30,
41,
22,
52,
47,
49,
28,
39,
40,
55,
24,
27,
24,
25,
35,
29,
28,
22,
22,
29,
46,
32,
31,
37,
25,
24,
32,
31,
21,
24,
19,
30,
38,
29,
55,
28,
30,
27,
34,
31,
21,
54,
26,
33,
25,
43,
24,
21,
36,
34,
33,
31,
46,
22,
22,
37,
31,
34,
37,
37,
33,
28,
36,
26,
29,
50,
43,
36,
21,
35,
23,
42,
33,
50,
47,
44,
24,
41,
36,
41,
30,
29,
22,
47,
43,
31,
37,
33,
29,
30,
26,
26,
50,
32,
36,
26,
30,
29,
55,
30,
37,
26,
23,
39,
42,
24,
37,
39,
21,
29,
27,
36,
39,
34,
35,
21,
49,
49,
26,
26,
34,
31,
42,
36,
42,
53,
25,
29,
47,
52,
25,
32,
31,
43,
46,
27,
23,
26,
57,
47,
42,
41,
55,
51,
32,
32,
47,
40,
52,
42,
28,
21,
33,
38,
43,
27,
38,
35,
49,
28,
24,
54,
42,
37,
35,
55,
27,
25,
21,
43,
33,
56,
42,
25,
36,
50,
27,
23,
41
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=4
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "4, 0",
"marker": {
"color": "#EF553B",
"symbol": "square"
},
"mode": "markers",
"name": "4, 0",
"showlegend": false,
"type": "scattergl",
"x": [
89.1,
103.7,
103.8,
84.15,
89.9,
105,
94.8,
96.1,
104.95,
95.6,
109.9,
73.95,
93.95,
89.85,
75.2,
75.6,
80.35,
90.05,
110.75,
79.85,
85.65,
91.7,
79.35,
78.85,
84.6,
94.65,
110.5,
103.85,
81.1,
75.4,
79.85,
91.35,
80.6,
70,
99.55,
69.75,
99.3,
97.1,
90.05,
99.05,
114.5,
78.95,
98.85,
86.05,
90.55,
95.3,
101.45,
98.55,
88.45,
109.8,
96.05,
113.6,
104.4,
89.65,
79.35,
86.55,
85.35,
107.35,
95.5,
95.4,
84.85,
89.15,
89.85,
96.8,
108.15,
86.15,
101.15,
97.7,
98.6,
85.7,
102.05,
106.4,
93.9,
106.35,
91.05,
94.55,
100.5,
86.45,
99.25,
73.55,
98.4,
93.85,
99.65,
85.25,
105.95,
94.05,
95.65,
88.4,
100.55,
101.35,
90.1,
88.95,
94.65,
94.7,
87,
89,
92.35,
105.35,
102.65,
105.85,
94.5,
84.15,
95.65,
79.65,
85.95,
106.75,
104.5,
93.2,
88.5,
87.8,
98.8,
88.8,
83.85,
106.15,
90.5,
99.15,
95.7,
72.25,
79.65,
89.05,
104.5,
75.75,
100.5,
95,
76,
89.4,
84.05,
103.65,
103.85,
102.95,
79.85,
98.7,
80,
90.85,
100.4,
93.9,
83.75,
98.1,
74.15,
84.3,
92.7,
108.2,
95,
103.65,
75.8,
102.8,
88.3,
94.7,
100.65,
96.6,
99.3,
74.9,
94.9,
99.95,
74.95,
96.8,
73.15,
106.65,
79.6,
94.55,
77.9,
101.3,
70.4,
96.15,
107.75,
95.4,
86.55,
90.5,
80.15,
104.05,
108.15,
104.3,
99.85,
105.7,
90.05,
100.85,
85.2,
100.3,
97.35,
95,
99.05,
85.8,
91,
89.55,
100.6,
99.05,
83.85,
96.9,
74.95,
89.3,
92.4,
91.95,
91.05,
104.75,
79.2,
89.75,
89.1,
99.85,
80.3,
103.6,
101.9,
105.35,
107.4,
75.4,
74.4,
99.75,
94.1,
104.5,
85.2,
95.05
],
"xaxis": "x",
"y": [
22,
49,
42,
22,
30,
19,
36,
37,
25,
27,
33,
34,
32,
35,
27,
23,
32,
49,
43,
25,
32,
30,
42,
22,
25,
22,
27,
50,
32,
23,
24,
32,
33,
34,
32,
32,
43,
40,
23,
49,
41,
37,
32,
47,
24,
23,
29,
20,
23,
34,
46,
41,
21,
35,
23,
31,
22,
47,
20,
49,
24,
25,
24,
21,
43,
33,
38,
34,
29,
26,
35,
30,
18,
32,
48,
40,
27,
27,
38,
31,
53,
59,
24,
36,
25,
30,
39,
25,
29,
22,
28,
24,
29,
25,
22,
20,
28,
33,
40,
20,
28,
32,
17,
30,
32,
37,
36,
22,
41,
29,
29,
26,
31,
42,
30,
21,
25,
37,
24,
16,
57,
27,
26,
27,
29,
20,
34,
55,
21,
24,
31,
23,
22,
49,
30,
45,
41,
26,
42,
22,
17,
20,
33,
45,
22,
25,
27,
22,
56,
31,
24,
36,
41,
39,
26,
20,
39,
17,
34,
27,
30,
28,
33,
32,
45,
21,
21,
22,
29,
23,
32,
27,
21,
30,
34,
45,
47,
37,
36,
36,
29,
26,
35,
43,
33,
54,
33,
23,
38,
45,
26,
36,
32,
42,
40,
22,
20,
18,
32,
18,
37,
34,
48,
24,
22,
18,
30,
40,
34,
18
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=0
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "0, 1",
"marker": {
"color": "#00cc96",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 0",
"showlegend": true,
"type": "scattergl",
"x": [
45.3,
35.9,
44.95,
49.15,
30.35,
49.65,
44.85,
53.95,
54.45,
40.3,
39.85,
50.6,
39.3,
24.85,
50.25,
50.35,
44.3
],
"xaxis": "x",
"y": [
58,
28,
23,
52,
44,
51,
57,
41,
53,
30,
35,
22,
40,
38,
59,
22,
59
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 1",
"marker": {
"color": "#ab63fa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 2",
"showlegend": true,
"type": "scattergl",
"x": [
103.4,
105.9,
106.45,
105.4,
107.25,
105.5,
96.75,
106.35,
100,
100.15,
100.55,
103.75,
99.8,
106.8,
94.25,
107.5,
99.5,
98.25,
104.35,
90.65,
104.1,
100.8,
95.75,
100.6,
105.55,
104.05,
99,
99.15,
102.95,
100.15,
89.95,
105.25,
104.8,
104.75,
103.95,
105.2,
106.5,
98.9,
98.7,
100.2,
98.6,
101.35,
104.15,
103.95,
106.15,
94.65,
106.25,
105.9,
99.5,
102.4,
105.3,
101.1,
99.9,
100.15,
106,
104.35,
104.65,
106.2,
106.15,
95.9,
100.6,
104.95,
103.5
],
"xaxis": "x",
"y": [
63,
60,
61,
67,
56,
65,
62,
61,
55,
62,
63,
62,
60,
56,
64,
63,
66,
56,
60,
65,
67,
66,
60,
57,
61,
66,
60,
61,
70,
62,
69,
53,
70,
56,
61,
66,
52,
58,
58,
68,
56,
62,
55,
69,
60,
72,
65,
60,
59,
63,
68,
59,
61,
55,
60,
65,
58,
61,
59,
68,
57,
72,
63
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 0",
"marker": {
"color": "#ab63fa",
"symbol": "square"
},
"mode": "markers",
"name": "2, 0",
"showlegend": false,
"type": "scattergl",
"x": [
99.5,
101.4,
94.65
],
"xaxis": "x",
"y": [
66,
67,
67
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=3
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "3, 1",
"marker": {
"color": "#FFA15A",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 3",
"showlegend": true,
"type": "scattergl",
"x": [
96.55
],
"xaxis": "x",
"y": [
24
],
"yaxis": "y"
},
{
"marker": {
"color": "grey",
"symbol": "square"
},
"mode": "markers",
"name": "Payment by electronic check",
"type": "scatter",
"y": [
null
]
},
{
"marker": {
"color": "grey",
"symbol": "x"
},
"mode": "markers",
"name": "Payment with other methods",
"type": "scatter",
"y": [
null
]
}
],
"layout": {
"legend": {
"title": {
"text": "Clusters and payment methods"
},
"tracegroupgap": 0
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "MonthlyCharges"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "tenure"
}
}
}
},
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig_fi = px.scatter(df_clusters.rename(columns={\"cluster_fi\": \"cluster\"}), \n",
" x=\"MonthlyCharges\", y=\"tenure\", color=\"cluster\",\n",
" symbol=\"PaymentMethod_Electronic check\",\n",
" symbol_map={0: \"square\", 1: \"x\"})\n",
"\n",
"get_distinct_legend_elements_for_cluster_and_payement(fig_fi)\n",
"\n",
"fig_fi.show()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-29T15:37:15.560431Z",
"start_time": "2020-12-29T15:37:15.471037Z"
}
},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "cluster=0
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "0, 1",
"marker": {
"color": "#636efa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 0",
"showlegend": true,
"type": "scattergl",
"x": [
29.85,
39.65,
30.2,
75.3,
50.55,
35.45,
44.35,
71.15,
45.65,
45.3,
24.8,
30.4,
25.25,
40.2,
41.15,
55,
44.8,
35.9,
44.95,
41.9,
54.1,
44,
44.3,
53.45,
55,
59,
28.45,
49.3,
29.95,
49.15,
34.7,
49.9,
49.25,
50.15,
45.35,
45.35,
52.2,
64.35,
50.8,
24.6,
56.4,
30.15,
56.75,
30.35,
70.3,
49.5,
40.05,
49.15,
43.65,
39.5,
35.55,
60.25,
53.8,
60.15,
49.95,
45.3,
30.9,
44.75,
44.05,
25.2,
49.65,
35,
66.25,
74.15,
50.45,
50.05,
42.6,
50.3,
45,
43.8,
69.95,
45.05,
34.7,
35.65,
74.4,
59.85,
45.4,
45.4,
75.5,
44.85,
47.95,
45.1,
45,
45.55,
35.1,
45.15,
43.3,
78.5,
30.5,
64.6,
34.25,
45.7,
44.6,
47.15,
77.4,
49.4,
48.7,
33.65,
54.35,
24.95,
66.85,
50.1,
60.85,
69.35,
49.85,
48.2,
25.15,
45.2,
47.8,
44.75,
55.45,
59.25,
35.9,
48.55,
45,
54.45,
49.4,
34.5,
49.25,
44,
53.95,
51.55,
24.5,
44.55,
34.7,
44.4,
55.2,
25.1,
50.15,
64.9,
54.45,
46.35,
55.3,
49.9,
30.4,
44.45,
54.2,
59.4,
45.3,
49.85,
55.25,
29.75,
74.65,
71.95,
29.9,
39.7,
24.4,
64,
70.75,
59.2,
54.9,
55.6,
45.9,
50.7,
51.05,
24.95,
43.3,
50.35,
59.45,
50.75,
45.65,
40.75,
55.35,
46.3,
48.35,
49.55,
25.25,
45.15,
45.8,
49.15,
49.35,
49,
55.8,
49.1,
44.55,
45.45,
43.75,
45.75,
42.9,
44,
57.55,
24.45,
24.25,
38.5,
50.55,
24.45,
51.35,
40.3,
50.6,
50.15,
38.9,
44.75,
25.05,
23.9,
39.85,
24.35,
70.05,
40.1,
50.6,
51.1,
44.15,
50.35,
24.75,
25.1,
24.7,
24.75,
54.2,
49.45,
61.15,
49.2,
45.15,
53.95,
54.55,
48.8,
29.4,
65.6,
25.25,
35.75,
46,
50.9,
47.95,
63.6,
44.1,
50.75,
39.3,
44.7,
35.2,
54.4,
30.45,
30.75,
53.65,
44.8,
69.35,
36.45,
54.3,
24.85,
53.75,
45.7,
45.6,
29.65,
50.8,
61.3,
30.5,
24.8,
76.4,
54.5,
31.05,
25.2,
46,
31.65,
39.05,
46.35,
48.6,
49.75,
60,
35,
45.55,
55.3,
25.15,
35.1,
44.6,
44.4,
51.4,
78.75,
29.6,
50.25,
41.6,
48.75,
24.7,
50.35,
56.15,
55,
44.55,
23.45,
55.4,
29.65,
54.3,
50.75,
49.15,
69.65,
50.5,
44.3,
49.15,
25.05,
48.95,
54.85,
45.3,
74.65,
56.25,
44.5,
25.3,
50.15,
54.65,
43.95,
29.15,
45.25,
45.3,
55.9,
49.4,
29.9,
39.65,
29.7,
50.35,
25.3,
35.15,
29.05,
55.35,
45.05,
49.95,
44.4,
29.6
],
"xaxis": "x",
"y": [
1,
1,
1,
3,
11,
1,
2,
8,
1,
58,
1,
3,
1,
1,
3,
14,
1,
28,
23,
21,
16,
1,
2,
2,
1,
2,
5,
1,
9,
52,
2,
1,
2,
3,
3,
2,
1,
5,
1,
1,
4,
13,
4,
44,
2,
1,
4,
13,
12,
5,
1,
3,
5,
1,
16,
1,
2,
6,
11,
1,
51,
18,
8,
12,
1,
1,
2,
4,
3,
1,
3,
17,
1,
11,
4,
1,
9,
2,
1,
57,
1,
1,
1,
10,
2,
1,
1,
7,
5,
3,
5,
1,
2,
5,
3,
2,
7,
4,
1,
5,
7,
1,
2,
11,
1,
7,
1,
1,
2,
1,
1,
8,
1,
4,
2,
13,
8,
7,
2,
1,
41,
15,
2,
4,
10,
7,
4,
3,
1,
11,
53,
14,
3,
1,
2,
2,
5,
16,
1,
8,
1,
3,
7,
13,
4,
19,
1,
5,
2,
1,
1,
11,
4,
4,
8,
9,
3,
5,
15,
1,
1,
9,
3,
1,
18,
1,
1,
9,
1,
6,
4,
15,
1,
15,
1,
8,
9,
1,
1,
1,
3,
4,
1,
8,
1,
20,
5,
30,
3,
1,
16,
7,
2,
13,
35,
2,
5,
1,
22,
15,
2,
6,
3,
1,
7,
1,
3,
6,
1,
5,
2,
1,
9,
7,
8,
4,
3,
1,
4,
4,
6,
3,
1,
14,
40,
2,
18,
8,
8,
3,
7,
4,
3,
1,
1,
38,
11,
5,
1,
10,
1,
4,
4,
1,
2,
1,
13,
11,
1,
13,
18,
14,
1,
1,
1,
1,
2,
2,
4,
13,
3,
1,
2,
13,
3,
59,
11,
9,
1,
22,
5,
6,
12,
1,
1,
4,
4,
15,
3,
14,
1,
59,
6,
1,
1,
6,
1,
9,
1,
2,
1,
16,
1,
2,
13,
2,
13,
4,
4,
3,
19,
15,
1,
3,
3,
4,
9,
12,
1,
6,
11
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=0
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "0, 0",
"marker": {
"color": "#636efa",
"symbol": "square"
},
"mode": "markers",
"name": "0, 0",
"showlegend": false,
"type": "scattergl",
"x": [
53.85,
45.25,
49.25,
49.05,
64.5,
24.3,
29.95,
45.3,
46,
50.05,
55.2,
54.4,
48.55,
44.6,
24.8,
50.55,
25.35,
50.65,
55.05,
70.05,
45.6,
65.55,
25.25,
34.55,
45.7,
24.25,
45.65,
64.4,
49.25,
44.05,
35.8,
40.3,
44.8,
45,
64.2,
44.4,
34.8,
44.95,
44.7,
45.7,
50.15,
50.25,
49.05,
56.15,
31.35,
24.6,
45.85,
58.7,
45.05,
50.3,
62.8,
74.1,
25.15,
45,
54.7,
70,
49.95,
55.8,
55.05,
51.25,
25.8,
45.85,
48.95,
29.05,
44.3,
50.15,
48.75,
43.85,
46.2,
45.95,
44.05,
45.55,
45.1,
50.95,
50.9,
54.65,
49.8,
25.5,
45.3,
60.95,
25.05,
24.7,
75.85,
44.45,
50.5,
43.95,
50.2,
51.2,
55.9,
48.75,
46.1,
45.95,
29.65,
30.25,
49.85,
38.55,
24.45,
70.45,
35.25,
44.55,
45.45,
54.75,
55.55,
50.4,
50.1,
55.3,
44.4,
41.35,
50.15,
48.25,
62.15,
44.6,
63.75,
45.05,
31,
60.65,
33.9,
25.25,
43.25,
45.4,
45.8,
68.65,
24.3,
53.5,
25.1,
75.15,
29.85,
36.45,
25.05,
50.45,
44.9,
29.8,
55.15,
35,
50.95,
46.3,
44.15,
50.85,
54.85,
50.7,
53.4,
50.6,
61.45,
44.95,
45.3,
29.2,
46.6,
44.9,
40,
45.85,
24.4,
50.15,
50.8,
30.55,
69.15,
50.75,
50.6,
58.5,
29.15,
24.45,
49.55,
25.2,
50.4,
54.45,
55.3,
74.75,
49.2,
44.8,
29.9,
35.2,
50.95,
34.25,
29.25,
54.35,
45.35,
25.05,
51,
65.7,
49.9,
49.95,
33.6,
50.8,
75.3,
66.4,
49.6,
40.1,
45.4,
48.65,
48.75,
44.75,
50.45,
49,
50.55,
44.15,
35.1,
59.55,
24.4,
65.25,
45.25,
61.2,
45.85,
44.45,
62.05,
60.1,
51.55,
46,
44.65,
44.55,
57.2,
55.5,
51,
24.35,
36.85,
45.15,
40.4,
30.5,
70.7,
51.25,
49.65,
64.4,
72.15,
44.75,
44.35,
45.4,
50.75,
46,
48.45,
51.75,
55.7,
34.7,
42.4,
55.7,
53.55,
49.65,
48.6,
25,
44,
44.3,
50.7,
35.9,
25.2,
24.9,
40.15,
45.3,
29.7,
49.8,
50.65,
55.1,
54.15,
24.9,
44.7,
25.85,
44.9,
25.7,
46.05,
35.05,
45.25,
49.9,
56.55,
49.25,
44.65,
55.1,
55,
24.4,
29.15,
70.75,
29.7,
62.05,
56.5,
56.7,
50.55,
45.85,
69,
43.95,
45.1,
53.55,
30.5,
24.2,
39,
35.45,
49.9,
60.4
],
"xaxis": "x",
"y": [
2,
1,
2,
1,
3,
5,
1,
1,
2,
4,
1,
2,
1,
2,
1,
5,
1,
1,
1,
9,
1,
4,
8,
10,
1,
4,
4,
3,
4,
5,
11,
3,
5,
6,
2,
1,
3,
2,
1,
1,
3,
3,
2,
3,
1,
9,
1,
3,
1,
2,
1,
1,
1,
2,
3,
5,
1,
3,
2,
1,
1,
1,
6,
2,
3,
1,
1,
1,
1,
1,
1,
1,
1,
4,
1,
3,
1,
8,
1,
2,
5,
1,
12,
1,
3,
1,
2,
1,
3,
13,
3,
1,
3,
2,
12,
4,
2,
1,
1,
4,
3,
1,
1,
4,
1,
1,
1,
3,
1,
4,
2,
1,
4,
1,
3,
3,
10,
1,
5,
1,
1,
4,
2,
1,
1,
5,
2,
3,
1,
1,
2,
3,
3,
4,
5,
1,
1,
4,
2,
4,
3,
1,
4,
1,
4,
3,
2,
1,
5,
2,
2,
2,
4,
1,
3,
1,
5,
4,
1,
1,
1,
1,
3,
2,
4,
12,
2,
4,
1,
3,
2,
3,
8,
2,
1,
7,
5,
2,
1,
2,
1,
6,
13,
2,
2,
7,
5,
5,
4,
1,
1,
1,
1,
1,
3,
1,
1,
3,
4,
2,
2,
1,
1,
1,
2,
4,
2,
1,
4,
4,
5,
7,
3,
1,
2,
6,
3,
1,
6,
4,
10,
3,
1,
1,
1,
5,
1,
4,
1,
9,
4,
1,
1,
1,
1,
3,
1,
1,
1,
1,
4,
1,
3,
1,
1,
1,
3,
2,
2,
2,
6,
1,
1,
1,
2,
1,
2,
1,
2,
1,
1,
3,
1,
1,
4,
7,
3,
2,
4,
2,
4,
1,
2,
1,
1,
1,
1,
1,
16,
3,
3,
4
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 1",
"marker": {
"color": "#EF553B",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 1",
"showlegend": true,
"type": "scattergl",
"x": [
70.7,
99.65,
69.7,
80.65,
94.4,
79.35,
74.7,
78.95,
89.85,
100.25,
74.4,
85.95,
82.4,
69.7,
104.4,
79.25,
91,
79.9,
70.15,
95,
75.35,
70.4,
106.9,
94.45,
85.4,
70,
89.35,
95.45,
90.4,
69.35,
80.6,
82.9,
70.35,
73.85,
72.1,
90.4,
89.15,
85.65,
81.35,
85.95,
112.95,
94.75,
75.1,
101.15,
99.8,
74.7,
96.1,
83.55,
100.15,
74.35,
74.4,
94.2,
80.5,
74.35,
70.05,
79.95,
85,
89.55,
70.2,
101.9,
70.5,
89.2,
85.7,
85.25,
89.55,
89.5,
69.65,
80,
85.95,
80.85,
80.45,
98.55,
90.35,
70.3,
93.35,
82,
98.5,
85.35,
69.55,
78.85,
89.9,
95.1,
105.1,
110.1,
83.9,
84.35,
93.85,
100.5,
73.55,
75.4,
81.7,
79.4,
81.15,
84.6,
83.25,
79.05,
75.6,
96,
90.55,
69.9,
75.25,
86.6,
94.3,
95.35,
68.95,
84.7,
100.6,
92.1,
79.45,
70.2,
80,
69.55,
80.95,
74.3,
80.55,
79.75,
95.15,
80.4,
95.1,
101.35,
90.45,
78.9,
74.9,
70.15,
80.25,
69.55,
80.3,
75.9,
76.95,
90.15,
75.8,
79.3,
80.15,
80.25,
89.5,
75,
75.6,
69.25,
87.25,
79.95,
94.75,
78.45,
70.2,
85.6,
79.2,
76,
93.85,
84.3,
101.1,
91.4,
100,
85.3,
70.4,
96.85,
75.65,
74.7,
84.8,
95.4,
75.35,
100.85,
69.95,
80.8,
91.7,
74.95,
69.35,
95.35,
111.4,
80.45,
74.7,
70.35,
88.8,
79.1,
69.75,
76.85,
80.15,
85.3,
99.75,
73.85,
82.75,
107.95,
94.9,
69.6,
69.9,
89.95,
90.5,
79,
91.15,
71.65,
98.7,
76.35,
74.85,
73.2,
83.75,
70.05,
86,
72.65,
78.95,
92,
81.05,
79.1,
80.75,
75.35,
75.45,
81.1,
74.95,
93.55,
95.25,
83.55,
69.95,
80.2,
86.45,
86.25,
81,
95.7,
88.15,
74.3,
69.65,
95.6,
71.35,
80.85,
79.95,
94.05,
70.2,
75.25,
75.3,
70.55,
91,
72.9,
80.55,
75.8,
86.05,
88.55,
91.3,
79.5,
86.25,
100.8,
86.3,
70.5,
70,
95.85,
102.45,
80.2,
86.85,
74.5,
85.65,
106.7,
90.25,
69.85,
90.6,
83.05,
84,
80.35,
82.65,
70.15,
105.3,
88.35,
94.2,
96.25,
70.7,
70.05,
84.8,
74.9,
104.85,
74.45,
89.35,
77.15,
80.45,
90.75,
75.7,
91.45,
83.3,
100.4,
94.6,
105.3,
76.05,
75.15,
70.1,
69.75,
70.3,
99.25,
84.8,
90.75,
95.15,
74.65,
78.75,
76.4,
98.7,
100.8,
79.25,
85.7,
89.5,
86.05,
70.15,
92.55,
85.35,
80.1,
74.55,
100.95,
94.9,
97.1,
74.4,
69.7,
98.1,
99.6,
94.2,
81.95,
69.35,
84.6,
91.1,
86.1,
71,
79.7,
69.25,
74.1,
99.4,
95.5,
69.9,
75.6,
93.85,
100.75,
90.4,
74.75,
84.45,
74.95,
84.95,
79.55,
84.5,
84.4,
85.55,
77.85,
87.05,
84.8,
74.05,
84.45,
76.45,
101.75,
72.75,
94.85,
80.55,
93.85,
94.2,
86.65,
101.8,
91.1,
101.35,
81.7,
79.15,
69.6,
80,
78.45,
84.45,
75.55,
85.65,
70.25,
75.35,
89.4,
84.05,
99.5,
83.2,
103.9,
95.1,
75.5,
73.75,
96.05,
88.95,
89.5,
69.8,
90.55,
91.4,
91.5,
75.35,
69.3,
84.75,
75.25,
74.2,
79.6,
71.05,
89.8,
80.5,
86.25,
71.25,
69.7,
75.1,
69.1,
71.15,
79.15,
78.5,
102,
96.6,
69.8,
84.05,
71.65,
94.25,
68.95,
93.85,
76.05,
80.35,
79.05,
95,
84.05,
89.8,
69.1,
81.45,
79.85,
71.65,
74.25,
74.2,
100.2,
89.05,
105.65,
73.9,
102.55,
103.1,
79.8,
74.95,
74.95,
78.8,
69.1,
78.55,
78.65,
74.4,
105.3,
84.55,
85.2,
76.5,
92.9,
93.5,
69.6,
100.55,
94.1,
70.5,
94.85,
79.55,
69.6,
78.05,
73.6,
74.75,
74,
85.45,
89,
74.9,
101.25,
86.55,
85.55,
90.6,
90.05,
75.1,
75.85,
68.5,
73.5,
94,
84.45,
70.2,
88.05,
91.85,
79.55,
70.15,
89.1,
76.4,
75.75,
80.3,
74.9,
79.85,
80.85,
89.15,
75.65,
90.7,
78.5,
79.9,
98.5,
88.45,
69.85,
79.9,
74.9,
70.35,
84.3,
70.1,
78.3,
94.4,
84.3,
99.55,
81.25,
75.3,
99.25,
79.75,
69.35,
85.8,
80.55,
84.5,
67.75,
90.35,
85.05,
94.75,
94.7,
92.5,
75.55,
70,
70.3,
86.2,
74.9,
99.85,
83.85,
78.85,
78.95,
74.35,
84.6,
94.65,
76.5,
80.85,
78.95,
79.4,
68.95,
94,
89.85,
105.5,
81,
69.8,
94.6,
70.4,
70.95,
104.4,
74.7,
90.8,
79.55,
103.45,
89.4,
81,
91.65,
100.2,
90.85,
96.05,
74.35,
70.3,
69.8,
85.55,
101.5,
89.15,
79.6,
75.85,
75.35,
95.7,
77,
75.3,
73.5,
70.4,
94,
80.2,
89.25,
86.2,
104.2,
76.25,
74.35,
69.65,
80.8,
84.9,
96.2,
98.75,
101.15,
81.15,
79.75,
94.55,
90.65,
90.1,
89.3,
95.2,
74.5,
79.65,
83.65,
90.1,
88.35,
89.35,
84.5,
70.3,
74.75,
80.25,
99.45,
70.6,
84.85,
80.85,
89.45,
79.9,
69.55,
88.85,
79.7,
84.6,
69.05,
73.65,
84.35,
84.95,
79.4,
94.4,
80.35,
81.1,
78.85,
89.45,
97.9,
79.8,
80.2,
69.85,
88.45,
75.5,
74.85,
96.65,
79.6,
75.9,
76.2,
79,
70.25,
86.55,
85.3,
75.7,
97.95,
89.4,
87.3,
70.15,
96.5,
91.55,
70.25,
69.65,
89.3,
74.8,
85.2,
81.3,
85.45,
71,
85.05,
70.3,
75.4,
75.8,
76.1,
69.65,
75.4,
100.6,
86,
85,
78.95,
89.25,
98,
94.45,
105,
84,
84.85,
89.15,
89.75,
85.15,
94.6,
94.25,
74.95,
89.75,
82.85,
83.6,
74.55,
76.6,
87.1,
94.95,
90.6,
70.2,
78.1,
90,
71,
70.65,
79.25,
70.1,
80.5,
80.7,
85.75,
98.25,
69,
100.5,
69.95,
93.3,
74.5,
73,
70.1,
85.9,
70.65,
79.45,
75.55,
95,
70.35,
95.85,
79.15,
79,
75.85,
91.85,
100.35,
98.9,
74.85,
101.95,
94,
84.05,
101.7,
70.1,
74.4,
90.65,
95.65,
75.05,
94.4,
101.45,
97,
69.5,
69.2,
69.65,
82.3,
79.25,
84.6,
85.85,
95.2,
79.85,
68.65,
73.8,
100.2,
99.7,
90.1,
70.85,
94.1,
80.8,
76.45,
91.3,
95.75,
78.75,
74.5,
86.5,
69.15,
79.55,
91.05,
79.2,
96.55,
74.3,
100.75,
89.2,
70.75,
96,
85,
69.2,
69.65,
74.95,
70.3,
86.8,
84.2,
79.7,
100.75,
91.65,
88.85,
95.45,
91.1,
89.5,
101.35,
80.7,
105.9,
85.5,
69.35,
69.6,
80.15,
82,
86.25,
101.25,
74.35,
80.5,
74.45,
75.75
],
"xaxis": "x",
"y": [
2,
8,
5,
2,
9,
1,
1,
12,
3,
10,
3,
13,
20,
2,
2,
13,
6,
1,
4,
11,
4,
2,
13,
16,
5,
1,
6,
4,
4,
5,
5,
11,
2,
7,
1,
2,
7,
2,
3,
10,
16,
8,
1,
4,
7,
1,
5,
8,
15,
1,
2,
2,
6,
5,
5,
2,
1,
12,
11,
15,
9,
4,
1,
10,
1,
2,
2,
1,
4,
5,
2,
10,
2,
3,
15,
2,
10,
6,
1,
4,
1,
3,
15,
10,
6,
7,
17,
9,
1,
16,
22,
3,
13,
4,
4,
6,
8,
2,
1,
1,
11,
1,
4,
7,
2,
5,
8,
8,
38,
14,
5,
3,
2,
13,
1,
9,
2,
3,
23,
15,
7,
17,
1,
3,
1,
7,
3,
2,
3,
11,
1,
7,
2,
4,
7,
8,
5,
1,
14,
10,
9,
4,
4,
10,
1,
1,
2,
15,
15,
2,
16,
5,
4,
13,
15,
1,
14,
3,
14,
8,
5,
6,
1,
1,
4,
10,
11,
12,
2,
2,
1,
1,
5,
9,
4,
3,
1,
3,
5,
3,
3,
1,
1,
14,
13,
2,
2,
1,
10,
1,
8,
19,
3,
1,
2,
16,
5,
3,
1,
3,
2,
1,
1,
7,
11,
1,
10,
17,
1,
2,
10,
16,
5,
12,
15,
1,
16,
1,
1,
17,
1,
9,
11,
3,
1,
1,
15,
11,
2,
2,
4,
2,
1,
1,
7,
1,
14,
4,
10,
1,
1,
2,
3,
1,
4,
12,
8,
3,
11,
15,
5,
3,
14,
1,
5,
1,
8,
5,
2,
1,
7,
7,
14,
4,
5,
1,
14,
6,
2,
2,
9,
7,
1,
12,
3,
7,
1,
1,
10,
7,
1,
1,
19,
4,
5,
2,
3,
13,
10,
2,
5,
1,
13,
17,
9,
4,
9,
3,
10,
2,
1,
8,
12,
4,
11,
1,
7,
12,
6,
14,
1,
1,
1,
6,
18,
9,
1,
9,
7,
22,
3,
2,
12,
14,
16,
1,
1,
6,
2,
4,
8,
11,
9,
13,
14,
15,
4,
3,
9,
1,
12,
10,
17,
10,
12,
1,
4,
1,
3,
1,
9,
1,
4,
1,
7,
12,
2,
11,
13,
21,
1,
6,
4,
12,
4,
10,
1,
1,
5,
15,
1,
2,
19,
8,
2,
1,
7,
5,
3,
2,
1,
8,
1,
1,
1,
20,
11,
11,
3,
2,
2,
2,
7,
1,
2,
4,
4,
1,
1,
12,
10,
6,
12,
10,
1,
3,
1,
4,
25,
4,
4,
17,
9,
12,
3,
11,
1,
1,
2,
1,
6,
6,
7,
8,
11,
14,
4,
2,
14,
7,
1,
10,
9,
1,
1,
7,
9,
1,
1,
7,
6,
15,
12,
5,
1,
4,
14,
3,
1,
11,
8,
29,
4,
9,
3,
1,
2,
1,
11,
8,
1,
1,
24,
9,
17,
4,
16,
3,
3,
10,
16,
1,
4,
7,
1,
3,
1,
12,
17,
1,
11,
8,
10,
23,
15,
1,
3,
1,
12,
2,
9,
1,
4,
8,
5,
2,
1,
2,
15,
4,
10,
9,
24,
6,
1,
12,
15,
2,
4,
1,
3,
5,
1,
15,
8,
16,
1,
24,
3,
2,
10,
1,
5,
2,
15,
17,
4,
4,
2,
1,
18,
11,
1,
6,
10,
9,
12,
2,
9,
4,
15,
3,
1,
8,
1,
11,
15,
1,
11,
17,
9,
1,
1,
9,
8,
7,
16,
8,
9,
2,
12,
33,
6,
6,
3,
8,
1,
19,
1,
13,
1,
5,
3,
10,
2,
12,
1,
6,
13,
9,
9,
1,
10,
7,
1,
9,
1,
6,
8,
15,
30,
21,
1,
14,
3,
3,
13,
5,
1,
4,
3,
7,
13,
1,
1,
1,
7,
1,
8,
15,
1,
4,
13,
19,
13,
15,
16,
3,
1,
1,
18,
5,
5,
17,
1,
9,
1,
7,
3,
3,
1,
18,
10,
1,
1,
14,
6,
13,
5,
3,
8,
1,
5,
7,
14,
3,
16,
2,
6,
6,
5,
3,
12,
8,
2,
1,
1,
14,
23,
9,
4,
1,
10,
1,
5,
5,
6,
7,
5,
1,
1,
3,
1,
1,
27,
2,
2,
5,
26,
2,
2,
1,
4,
9,
17,
13,
10,
9,
7,
2,
13,
4,
2,
1,
4,
2,
10,
1,
1,
13,
1,
1,
1,
1,
3,
13,
2,
10,
2,
1,
9,
14,
15,
9,
1,
13,
1,
1,
12,
6,
16,
1,
7,
1,
9,
3,
2,
5,
14,
13,
11,
2,
12,
1,
1,
3,
4,
1,
7,
6,
6,
11,
14,
4,
1,
13,
6,
8,
3,
3,
9,
1,
1,
5,
13,
9,
27,
4,
13,
1,
1
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=1
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "1, 0",
"marker": {
"color": "#EF553B",
"symbol": "square"
},
"mode": "markers",
"name": "1, 0",
"showlegend": false,
"type": "scattergl",
"x": [
95.5,
97.85,
99.1,
80.65,
79.85,
75.15,
99.3,
70.45,
95,
80.9,
70.9,
74.45,
76.45,
105.35,
84.5,
80.05,
78.3,
80,
84.6,
70.6,
73.6,
82.65,
80.6,
84.8,
80.25,
96.5,
90.85,
73.25,
75.3,
69.85,
69.55,
69,
99.7,
78,
86.05,
75.3,
74.55,
78.55,
69.55,
74.6,
95.1,
74.75,
75.05,
107.95,
71.1,
75.1,
86,
75.05,
85.9,
88.9,
86.2,
89.45,
95.6,
80.6,
98.9,
98.3,
89,
75.1,
74.4,
100.3,
69.55,
95.9,
88.3,
90.45,
84.7,
89.55,
69.75,
98.05,
89.7,
100.45,
74.75,
94.4,
74.65,
104.05,
75.2,
96.65,
89.75,
80,
109.9,
85.7,
85.6,
75.35,
75.2,
70.15,
70.7,
82.85,
99.8,
84.4,
99.95,
75.55,
80.8,
74.6,
74.4,
79.5,
90,
95.6,
89.05,
75.75,
75.9,
85.35,
79.5,
85.8,
74.6,
83.8,
74.25,
87.15,
84.75,
78.1,
90.95,
70.7,
90.9,
75.5,
87.1,
75.9,
70.6,
69.75,
90.75,
85.2,
74.4,
70.1,
71.45,
80.1,
98.15,
112.95,
70.9,
100.15,
71.55,
85.3,
85.05,
70.4,
85.55,
93,
103.35,
81.5,
74.2,
85.65,
86.05,
74.25,
69.5,
80.1,
98.15,
69.95,
80.2,
80.55,
83.4,
70.7,
84.35,
89.6,
70.05,
79.65,
80.45,
94.85,
95.65,
74.3,
74.65,
98.1,
88.35,
79.95,
73.5,
83.8,
105.85,
75.45,
80.3,
70.25,
89.15,
85.4,
75.75,
105.35,
69.95,
74.3,
95.1,
76.65,
99.15,
75.1,
81.5,
70.55,
100.85,
69.1,
77.95,
83.15,
74.15,
85.45,
85.05,
75.45,
70.6,
71.3,
85.2,
73.25,
85.35,
84.8,
74.6,
79.15,
89.65,
75,
99.45,
70.1,
70.2,
100.15,
88.4,
75,
70.8,
89.05,
89.35,
73.6,
94.05,
70.85,
101.55,
80.15,
69.95,
93.55,
80.85,
73.85,
69.95,
90.7,
74.8,
71,
78.15,
82.3,
87.95,
73.3,
79.9,
96.2,
70.3,
69.95,
90.2,
89.8,
85.15,
80.35,
69.9,
79.7,
83.55,
94.65,
70.45,
79.5,
80.5,
100.25,
81.7,
69.4,
83.2,
73.75,
79.35,
92.7,
80.05,
99.95,
79.65,
74.05,
70.7,
74.9,
94.2,
100.7,
104.1,
79,
70.05,
78.75,
71.1,
73.75,
69.15,
93.9,
80.55,
84.05,
74.45,
69.4,
94.45,
93.8,
79.55,
75.1,
94.5,
85.35,
79.65,
79.95,
75.35,
94.7,
75.65,
75.3,
81.9,
72.6,
80.3,
73.55,
69.05,
80.05,
70.45,
92.5,
74.45,
95.5,
90.8,
81,
94,
84.65,
84.85,
71.8,
70.15,
69.2,
83.9,
80.5,
94.85,
69.95,
74.75,
84.6,
69.6,
85.15,
78.1,
80.5,
71.35,
81,
70.15,
96.3,
85.95,
79.35,
90.8,
70.4,
70,
70.5,
80.75,
79.15,
91.5,
80.85,
94.9,
70.75,
85.3,
86.85,
102.25,
93.2,
74.35,
95.15,
104.15,
72.2,
76.4,
99,
77.65,
73.85,
68.6,
74.9,
74.3,
80.7,
69.25,
87.75,
69.95,
74.85,
76,
79.75,
74.9,
69.8,
80.1,
69.9,
94.05,
102.1,
74.6,
74.1,
75,
78.9,
70.15,
105.95,
90.35,
99,
91.75,
79.55,
69.7,
73.75,
89.85,
74.45,
75.15,
102.6,
95.65,
75.05,
70.65,
74.4
],
"xaxis": "x",
"y": [
2,
11,
15,
8,
10,
7,
9,
1,
7,
14,
4,
15,
7,
15,
8,
14,
13,
8,
1,
1,
1,
17,
2,
4,
10,
5,
1,
16,
1,
7,
1,
15,
12,
11,
10,
1,
16,
7,
3,
1,
10,
3,
1,
3,
1,
3,
14,
3,
15,
5,
2,
16,
7,
4,
12,
9,
15,
16,
3,
8,
4,
9,
3,
14,
10,
2,
2,
7,
11,
17,
16,
4,
7,
11,
11,
13,
12,
13,
6,
3,
15,
15,
9,
10,
2,
4,
4,
9,
12,
5,
4,
1,
13,
11,
2,
16,
13,
9,
11,
17,
11,
1,
8,
2,
9,
2,
3,
12,
17,
8,
14,
9,
4,
5,
1,
1,
2,
8,
7,
7,
5,
3,
6,
12,
1,
8,
1,
5,
16,
17,
1,
9,
8,
2,
15,
8,
3,
1,
1,
8,
13,
8,
1,
2,
1,
2,
15,
4,
4,
7,
8,
5,
1,
16,
13,
4,
3,
12,
1,
12,
20,
7,
4,
5,
1,
5,
10,
3,
16,
1,
2,
4,
5,
15,
17,
6,
4,
1,
4,
5,
10,
1,
12,
2,
1,
2,
7,
2,
9,
11,
1,
1,
14,
8,
9,
8,
2,
12,
9,
13,
1,
16,
7,
3,
6,
1,
3,
1,
2,
6,
1,
16,
1,
3,
4,
14,
10,
3,
6,
12,
5,
11,
3,
1,
17,
14,
12,
14,
7,
2,
6,
16,
1,
16,
17,
1,
12,
1,
15,
13,
9,
17,
10,
6,
3,
8,
1,
2,
2,
16,
5,
11,
9,
5,
1,
7,
7,
5,
16,
4,
16,
1,
8,
13,
12,
7,
6,
16,
2,
16,
1,
7,
5,
15,
13,
2,
7,
2,
5,
1,
13,
10,
1,
12,
16,
5,
15,
1,
5,
16,
1,
7,
3,
11,
9,
7,
3,
10,
3,
6,
11,
6,
1,
10,
1,
15,
6,
1,
9,
2,
2,
17,
16,
11,
3,
12,
4,
1,
9,
2,
13,
16,
7,
11,
13,
4,
1,
3,
9,
6,
15,
2,
1,
10,
6,
15,
5,
2,
15,
2,
15,
2,
5,
1,
7,
10,
3,
3,
3,
4,
13,
14,
5,
13,
9,
1,
1,
12,
3,
3,
3,
9,
8,
3,
1,
4
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=4
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "4, 0",
"marker": {
"color": "#00cc96",
"symbol": "square"
},
"mode": "markers",
"name": "Cluster 4",
"showlegend": true,
"type": "scattergl",
"x": [
89.1,
103.7,
103.8,
84.15,
89.9,
105,
95.15,
94.8,
96.1,
104.95,
95.6,
109.9,
73.95,
93.95,
75.6,
89.85,
75.2,
75.6,
80.35,
90.05,
110.75,
79.85,
85.65,
91.7,
79.35,
78.85,
84.6,
94.65,
110.5,
103.85,
81.1,
75.4,
104.55,
79.85,
91.35,
80.6,
70,
99.55,
69.75,
99.3,
97.1,
90.05,
99.05,
114.5,
78.95,
98.85,
86.05,
87.9,
86,
90.55,
80.7,
95.3,
101.45,
98.55,
88.45,
109.8,
96.05,
113.6,
104.4,
89.65,
89.65,
79.35,
86.55,
73.85,
85.35,
107.35,
95.5,
95.4,
84.85,
89.15,
89.85,
96.8,
108.15,
80.55,
86.15,
101.15,
99.5,
97.7,
98.6,
85.7,
102.05,
106.4,
93.9,
106.35,
91.05,
90.7,
94.55,
100.5,
86.45,
99.25,
73.55,
90,
98.4,
93.85,
99.65,
85.25,
105.95,
94.05,
95.65,
88.4,
100.55,
101.35,
88.95,
94.65,
101.4,
94.7,
87,
89,
92.35,
105.35,
102.65,
94.5,
84.15,
95.65,
79.65,
85.95,
106.75,
104.5,
93.2,
88.5,
84.3,
87.8,
98.8,
88.8,
83.85,
106.15,
90.5,
99.15,
95.7,
72.25,
79.65,
104.5,
75.75,
100.5,
95,
74.05,
94.65,
95.95,
85.8,
76,
89.4,
84.05,
103.65,
103.85,
102.95,
79.85,
98.7,
80,
90.85,
100.4,
93.9,
83.75,
98.1,
74.15,
84.3,
108.2,
69.8,
95,
103.65,
75.8,
102.8,
88.3,
94.7,
100.65,
96.6,
99.3,
74.9,
94.9,
99.95,
74.95,
96.8,
73.15,
106.65,
79.6,
94.55,
77.9,
101.3,
90.7,
70.4,
80.55,
96.15,
107.75,
101.3,
95.4,
86.55,
90.5,
80.15,
104.05,
108.15,
104.3,
99.85,
105.7,
80.05,
90.05,
71.3,
100.85,
85.2,
100.3,
97.35,
95,
99.05,
95.9,
85.8,
91,
89.55,
100.6,
99.05,
83.85,
96.9,
74.95,
89.3,
92.4,
91.95,
91.05,
74.15,
104.75,
79.2,
89.75,
89.1,
99.85,
80.3,
103.6,
101.9,
105.35,
107.4,
75.4,
74.4,
99.75,
94.1,
104.5,
85.2,
95.05,
78.7
],
"xaxis": "x",
"y": [
22,
49,
42,
22,
30,
19,
18,
36,
37,
25,
27,
33,
34,
32,
18,
35,
27,
23,
32,
49,
43,
25,
32,
30,
42,
22,
25,
22,
27,
50,
32,
23,
21,
24,
32,
33,
34,
32,
32,
43,
40,
23,
49,
41,
37,
32,
47,
18,
19,
24,
20,
23,
29,
20,
23,
34,
46,
41,
21,
35,
19,
23,
31,
19,
22,
47,
20,
49,
24,
25,
24,
21,
43,
18,
33,
38,
66,
34,
29,
26,
35,
30,
18,
32,
48,
20,
40,
27,
27,
38,
31,
18,
53,
59,
24,
36,
25,
30,
39,
25,
29,
22,
24,
29,
67,
25,
22,
20,
28,
33,
40,
28,
32,
17,
30,
32,
37,
36,
22,
41,
18,
29,
29,
26,
31,
42,
30,
21,
25,
37,
24,
57,
27,
26,
27,
21,
67,
18,
20,
29,
20,
34,
55,
21,
24,
31,
23,
22,
49,
30,
45,
41,
26,
42,
22,
20,
20,
33,
45,
22,
25,
27,
22,
56,
31,
24,
36,
41,
39,
26,
20,
39,
17,
34,
27,
30,
28,
18,
33,
18,
32,
45,
18,
21,
21,
22,
29,
23,
32,
27,
21,
30,
17,
34,
20,
45,
47,
37,
36,
36,
29,
19,
26,
35,
43,
33,
54,
33,
23,
38,
45,
26,
36,
32,
18,
42,
40,
22,
20,
18,
32,
18,
37,
34,
48,
24,
22,
18,
30,
40,
34,
18,
19
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 1",
"marker": {
"color": "#ab63fa",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 2",
"showlegend": true,
"type": "scattergl",
"x": [
104.8,
105.5,
90.05,
99.35,
106.35,
84.5,
90.25,
95.45,
100.5,
98.5,
96.75,
91.65,
76.5,
78.05,
96.55,
106.6,
86.8,
73.15,
74.4,
89.85,
107.05,
105.05,
74.5,
76.1,
100.8,
74.9,
101.15,
89.05,
93.15,
103.4,
86.75,
85.45,
95.05,
74.95,
83.3,
80.4,
105.9,
81.05,
104.15,
80.25,
81.45,
94.1,
106.45,
105.4,
100.05,
107.25,
100.25,
110.85,
94.55,
95.15,
84.25,
105.5,
94.55,
83.15,
84.9,
94.5,
87.25,
75.5,
98.55,
89.25,
74.25,
95.8,
96.75,
101.3,
111.2,
106.35,
103.1,
88.8,
100,
100.15,
73.65,
100.55,
72.85,
80.7,
86.45,
99.05,
95.1,
86.1,
103.75,
75.5,
90.1,
86.1,
83.75,
90.6,
89.25,
98.85,
90.4,
105.65,
100.4,
94.3,
99.25,
69,
78.3,
96.15,
90.45,
105.15,
107.5,
86.6,
85.2,
97.65,
109.55,
88.35,
95.05,
82.15,
69.25,
94.25,
85.8,
84.35,
95.5,
99.8,
73.85,
94.5,
108.3,
98.75,
104.7,
96.7,
106.8,
88.2,
94.25,
71.1,
76.65,
92.6,
107.5,
85.9,
99.5,
90.25,
94.75,
86.45,
98.25,
90.05,
102.6,
90.35,
84.65,
94.65,
78.9,
70.55,
94.2,
110.75,
113.2,
104.35,
79.15,
85,
85.3,
90.65,
96,
90.05,
85.35,
99,
99.8,
85.6,
90.7,
84.75,
74.95,
98.75,
104.1,
90.8,
79.35,
103.85,
92.95,
85.35,
101.05,
93.2,
93.35,
80.15,
80.45,
101.1,
84.1,
74.6,
85,
98.5,
95.25,
85.15,
99.85,
89.95,
89.95,
76.45,
100.8,
91.55,
99.85,
104.15,
94.25,
70.3,
90.7,
99.95,
106.1,
106.35,
100.7,
90.45,
89.7,
96.4,
95.75,
98.9,
101.3,
100.6,
104.35,
105.55,
110.45,
85.3,
83.35,
90.35,
79.85,
91,
96.35,
104.9,
104.05,
98.7,
99,
85.75,
85.1,
99.15,
102.95,
93.5,
74.55,
99.8,
99,
100.75,
100.15,
85.95,
90,
89.95,
79.5,
74.4,
89.2,
71.05,
69.3,
106.4,
100.05,
68.65,
95.4,
99.55,
70,
90.7,
101.4,
100.2,
95.9,
89.85,
104.3,
80,
80.25,
105.25,
83.8,
78.45,
87.45,
70.75,
68.25,
105.1,
84.9,
95.45,
100.95,
103.45,
94.75,
97.8,
106.3,
93.8,
101.9,
94.3,
101.05,
94.7,
104.8,
91.15,
104.75,
74.15,
77.8,
83.45,
75.2,
84.85,
95.05,
93.8,
95.7,
96.2,
85.25,
80.5,
79.5,
81.2,
84.2,
75.25,
103.95,
73.7,
105.75,
95.9,
104.1,
96.55,
111.5,
101.75,
101,
98.85,
89.6,
80.4,
99.65,
106.5,
98.4,
105.2,
101.4,
91.25,
100.3,
85.45,
73.55,
104.65,
101,
96.5,
100.2,
111.95,
100.65,
88.85,
109.1,
106.4,
90.2,
96.2,
94.8,
106.5,
105.7,
99.75,
98.9,
84.85,
74,
98.7,
95.8,
100.2,
93.55,
95.55,
94.95,
98.6,
80.5,
84.8,
75.2,
101.35,
98.65,
103.3,
84.75,
104.15,
88.75,
104.45,
90.95,
73.9,
96.55,
69.75,
101.25,
84.05,
94.4,
78.25,
84.95,
89.45,
86.5,
103.95,
89.55,
103.3,
69.8,
99.7,
94.65,
78.2,
94.2,
96.8,
80.6,
100.05,
85.25,
105.35,
106.15,
81.15,
102.8,
79.5,
93.6,
104.4,
100.25,
100,
94.1,
94.65,
104.35,
84.9,
100.45,
91.25,
96.8,
80.65,
84.85,
106.25,
99.8,
90,
83.05,
76.25,
91.15,
100.85,
99.5,
84.35,
85.7,
107.55,
106.15,
90.85,
98.35,
84.3,
95.7,
94.5,
95.6,
78.8,
90.6,
104.6,
99.15,
82.35,
85.15,
104.45,
92.15,
93.8,
83.4,
99.7,
96.1,
104.25,
94.55,
84.1,
104.4,
101.5,
103.95,
89.4,
80.35,
92.55,
107.55,
88.7,
76.05,
101.1,
105.9,
89.2,
85.45,
89.8,
98.65,
104.95,
78.9,
84.75,
89.15,
100.45,
74.2,
77.75,
73.85,
95.15,
84.95,
83.75,
70.8,
103.45,
84.3,
94.75,
93,
95.25,
101.25,
74.65,
104.4,
79.3,
86.85,
90.8,
99.95,
99.5,
89.2,
87.55,
102.4,
106.4,
75.55,
70.55,
70.45,
69.1,
88.25,
97.35,
95.6,
84.5,
78.8,
93.85,
108.9,
89.9,
78.55,
99.45,
94.7,
105.2,
103.85,
105.3,
88.95,
94.45,
101.1,
95.05,
104.2,
99.5,
91.05,
89.1,
104.2,
77.85,
99.9,
74.7,
85,
93.5,
83.95,
100.15,
106,
74.3,
104.1,
94.4,
104.35,
102.6,
73.1,
77.5,
79.25,
101.35,
104.65,
100.05,
101.85,
103.05,
94.2,
105.8,
106.1,
100,
106.2,
105,
101.4,
81.45,
103.65,
99.05,
85.6,
106.15,
98.35,
85.45,
95.9,
100.6,
89.55,
100.1,
79.9,
92.5,
109.95,
98.8,
81.3,
89.1,
86.05,
103,
103.75,
73.85,
95.55,
89.5,
93.6,
88.05,
76.1,
81,
89.2,
104.95,
103.5
],
"xaxis": "x",
"y": [
28,
25,
21,
47,
34,
49,
43,
18,
47,
25,
55,
43,
37,
27,
20,
19,
23,
18,
15,
57,
20,
52,
8,
24,
35,
32,
38,
22,
24,
63,
17,
55,
42,
29,
22,
36,
60,
28,
24,
24,
20,
20,
61,
67,
34,
56,
35,
28,
35,
25,
23,
65,
20,
35,
29,
33,
45,
25,
20,
22,
41,
33,
62,
40,
21,
61,
47,
37,
55,
62,
20,
63,
10,
26,
30,
35,
22,
32,
62,
27,
18,
45,
26,
23,
24,
46,
25,
39,
32,
43,
35,
17,
34,
16,
23,
45,
30,
16,
18,
34,
47,
18,
13,
61,
22,
34,
29,
24,
35,
60,
44,
31,
42,
24,
41,
22,
56,
19,
64,
18,
17,
17,
63,
25,
66,
30,
23,
35,
56,
30,
38,
37,
42,
51,
29,
27,
17,
52,
41,
60,
23,
32,
32,
65,
24,
54,
52,
48,
49,
23,
31,
16,
23,
47,
67,
26,
22,
48,
37,
34,
56,
32,
33,
22,
31,
46,
21,
25,
30,
29,
13,
30,
34,
20,
28,
17,
66,
40,
23,
44,
21,
35,
31,
31,
28,
47,
46,
28,
25,
16,
60,
31,
30,
57,
31,
61,
33,
47,
33,
24,
19,
28,
34,
32,
66,
49,
60,
26,
22,
61,
70,
32,
11,
41,
51,
27,
62,
24,
37,
69,
27,
32,
44,
50,
25,
23,
37,
21,
36,
38,
17,
39,
31,
28,
25,
34,
54,
40,
41,
53,
23,
31,
34,
29,
33,
34,
40,
35,
19,
31,
38,
51,
41,
31,
53,
21,
24,
18,
70,
37,
56,
18,
18,
38,
43,
43,
50,
31,
50,
32,
20,
26,
32,
40,
51,
39,
61,
21,
26,
29,
30,
24,
44,
42,
46,
32,
32,
46,
57,
41,
41,
66,
35,
26,
42,
18,
18,
24,
43,
36,
30,
41,
22,
18,
52,
47,
20,
49,
17,
52,
28,
39,
58,
40,
55,
58,
14,
68,
24,
27,
19,
56,
24,
25,
35,
62,
29,
28,
22,
55,
22,
46,
32,
31,
37,
25,
24,
32,
17,
19,
18,
31,
21,
69,
24,
19,
18,
30,
38,
18,
29,
55,
28,
30,
27,
34,
60,
31,
21,
54,
26,
33,
25,
43,
24,
72,
21,
36,
34,
33,
19,
18,
31,
65,
46,
22,
22,
37,
31,
34,
37,
20,
37,
33,
28,
36,
26,
29,
50,
43,
14,
20,
19,
22,
36,
21,
35,
23,
42,
33,
50,
47,
44,
24,
41,
36,
41,
30,
29,
22,
47,
17,
43,
20,
31,
37,
60,
29,
30,
26,
26,
50,
32,
36,
26,
30,
29,
55,
11,
37,
26,
23,
17,
39,
42,
18,
24,
37,
39,
5,
21,
29,
19,
20,
19,
59,
27,
36,
63,
39,
34,
35,
20,
21,
17,
21,
49,
49,
26,
26,
34,
31,
18,
42,
36,
42,
53,
68,
25,
29,
59,
47,
52,
25,
32,
19,
31,
43,
61,
18,
46,
23,
26,
55,
60,
57,
47,
42,
65,
41,
55,
51,
32,
32,
58,
47,
40,
52,
42,
28,
21,
33,
61,
38,
43,
27,
38,
35,
18,
59,
49,
28,
68,
57,
24,
54,
42,
37,
35,
55,
27,
25,
21,
43,
33,
56,
42,
25,
36,
50,
27,
23,
41,
72,
63
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=2
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "2, 0",
"marker": {
"color": "#ab63fa",
"symbol": "square"
},
"mode": "markers",
"name": "2, 0",
"showlegend": false,
"type": "scattergl",
"x": [
98.6,
96.65,
90.1,
91,
89.35,
100.05
],
"xaxis": "x",
"y": [
17,
17,
28,
20,
19,
22
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=3
PaymentMethod_Electronic check=1
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "3, 1",
"marker": {
"color": "#FFA15A",
"symbol": "x"
},
"mode": "markers",
"name": "Cluster 3",
"showlegend": true,
"type": "scattergl",
"x": [
18.85,
19.85,
19.45,
20.55,
21,
19.3,
19.45,
19.2,
20.7,
19.75,
20.65,
19.9,
19.95
],
"xaxis": "x",
"y": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"yaxis": "y"
},
{
"hovertemplate": "cluster=3
PaymentMethod_Electronic check=0
MonthlyCharges=%{x}
tenure=%{y}",
"legendgroup": "3, 0",
"marker": {
"color": "#FFA15A",
"symbol": "square"
},
"mode": "markers",
"name": "3, 0",
"showlegend": false,
"type": "scattergl",
"x": [
20.15,
20.2,
20.2,
19.75,
20.75,
20.25,
19.25,
19.15,
19.9,
19.6,
20.4,
19.85,
19.55,
19.9,
19,
20.05,
20.45,
20.65,
19.55,
20.8,
19.9,
20.05,
19.75,
19.65,
21.1,
19.45,
20.15,
19.85,
20.35,
19.55,
20.05,
19.05,
19.5,
19.2,
20.05,
20.2,
20.9,
21.05,
20.2,
20.15,
20.45,
20.15,
19.4,
19.6,
19.75,
20.45,
20.95,
19.65,
20.5,
20.45,
19.5,
19.2,
25,
19.1,
19.8,
20.1,
20.3,
19.4,
19.5,
20.9,
19.45,
20.35,
20.5,
20.1,
20.05,
20,
19.65,
24.05,
20.4,
20.5,
19.75,
20.25,
20.2,
20.25,
19.75,
19.5,
19.75,
25.75,
19.1,
20.15,
20.25,
20.9,
19.75,
20.95,
20,
19.45,
20.25,
19.55,
20.3,
19.9,
18.9,
20.15,
19.4,
20.2,
19.65,
20.6,
19.1,
19.9,
19.65,
20.2,
20.55,
19.3,
20.2,
20.05,
19.25,
20.85,
19.65,
20.05,
20.6,
20.2,
19.95,
20.05,
19.7,
20.25,
20.3,
19.55,
20.4,
19.55,
18.85,
20.3,
20.1,
19.9,
20.35,
19.9,
19.65,
20.2,
19.3,
20.5
],
"xaxis": "x",
"y": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"yaxis": "y"
},
{
"marker": {
"color": "grey",
"symbol": "square"
},
"mode": "markers",
"name": "Payment by electronic check",
"type": "scatter",
"y": [
null
]
},
{
"marker": {
"color": "grey",
"symbol": "x"
},
"mode": "markers",
"name": "Payment with other methods",
"type": "scatter",
"y": [
null
]
}
],
"layout": {
"legend": {
"title": {
"text": "Clusters and payment methods"
},
"tracegroupgap": 0
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "MonthlyCharges"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "tenure"
}
}
}
},
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig_rf = px.scatter(df_clusters.rename(columns={\"cluster_rf\": \"cluster\"}), \n",
" x=\"MonthlyCharges\", y=\"tenure\", color=\"cluster\",\n",
" symbol=\"PaymentMethod_Electronic check\",\n",
" symbol_map={0: \"square\", 1: \"x\"})\n",
"\n",
"get_distinct_legend_elements_for_cluster_and_payement(fig_rf)\n",
"\n",
"fig_rf.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"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",
"version": "3.8.6"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}