{"cells":[{"metadata":{},"cell_type":"markdown","source":"

HEART FAILURE PREDICTION

"},{"metadata":{},"cell_type":"markdown","source":"![](https://inteng-storage.s3.amazonaws.com/img/iea/Xy6xeK3Wwr/sizes/heart-attack-ai-oxford_md.jpg)"},{"metadata":{},"cell_type":"markdown","source":"\nIn this notebook we evaluate several variables to determine how they may relate to whether a patient dies or survives a heart failure event. \n\nThe variables that are included in this data set are:\n* Age \n* Anemia \n* Creatinine Phosphokinase \n* Diabetes \n* Ejection Fraction \n* High Blood Pressure \n* Platelets \n* Serum Creatinine \n* Serum Sodium \n* Sex \n* Smoking \n* Time (Follow-up period (days))\n"},{"metadata":{},"cell_type":"markdown","source":"

Table of Contents

\n\n* I. Load Libraries & Packages \n* II. Data Overview & Insights \n* III. Outliers \n* IV. Exploratory Data Analysis \n * IVa. Univariate Analysis \n * IVb. Bivariate Analysis \n * IVc. Multivariate Analysis \n* V. Data Normalization (coming soon) \n* VI. Model Development (coming soon)"},{"metadata":{},"cell_type":"markdown","source":"# I. LIBRARIES & PACKAGES"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport missingno as msno\n\n# Plotly Packages\nfrom plotly import tools\nimport plotly.figure_factory as ff\nimport plotly.graph_objects as go\nfrom plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\nimport plotly.express as px\nfrom plotly.subplots import make_subplots\ninit_notebook_mode(connected=True)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","execution_count":2,"outputs":[{"output_type":"display_data","data":{"text/html":" \n "},"metadata":{}},{"output_type":"stream","text":"/kaggle/input/heart-failure-clinical-data/heart_failure_clinical_records_dataset.csv\n","name":"stdout"}]},{"metadata":{},"cell_type":"markdown","source":"# II. DATA OVERVIEW & INSIGHTS"},{"metadata":{"trusted":true},"cell_type":"code","source":"df = pd.read_csv('../input/heart-failure-clinical-data/heart_failure_clinical_records_dataset.csv')\ndf.head()","execution_count":3,"outputs":[{"output_type":"execute_result","execution_count":3,"data":{"text/plain":" age anaemia creatinine_phosphokinase diabetes ejection_fraction \\\n0 75.0 0 582 0 20 \n1 55.0 0 7861 0 38 \n2 65.0 0 146 0 20 \n3 50.0 1 111 0 20 \n4 65.0 1 160 1 20 \n\n high_blood_pressure platelets serum_creatinine serum_sodium sex \\\n0 1 265000.00 1.9 130 1 \n1 0 263358.03 1.1 136 1 \n2 0 162000.00 1.3 129 1 \n3 0 210000.00 1.9 137 1 \n4 0 327000.00 2.7 116 0 \n\n smoking time DEATH_EVENT \n0 0 4 1 \n1 0 6 1 \n2 1 7 1 \n3 0 7 1 \n4 0 8 1 ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ageanaemiacreatinine_phosphokinasediabetesejection_fractionhigh_blood_pressureplateletsserum_creatinineserum_sodiumsexsmokingtimeDEATH_EVENT
075.005820201265000.001.91301041
155.0078610380263358.031.11361061
265.001460200162000.001.31291171
350.011110200210000.001.91371071
465.011601200327000.002.71160081
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"df.columns","execution_count":4,"outputs":[{"output_type":"execute_result","execution_count":4,"data":{"text/plain":"Index(['age', 'anaemia', 'creatinine_phosphokinase', 'diabetes',\n 'ejection_fraction', 'high_blood_pressure', 'platelets',\n 'serum_creatinine', 'serum_sodium', 'sex', 'smoking', 'time',\n 'DEATH_EVENT'],\n dtype='object')"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"# CHANGE SPELLING OF ANAEMIA COLUMN TO 'ANEMIA'\ndf.rename(columns={'anaemia':'anemia'}, inplace=True)","execution_count":5,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"df.info()","execution_count":6,"outputs":[{"output_type":"stream","text":"\nRangeIndex: 299 entries, 0 to 298\nData columns (total 13 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 age 299 non-null float64\n 1 anemia 299 non-null int64 \n 2 creatinine_phosphokinase 299 non-null int64 \n 3 diabetes 299 non-null int64 \n 4 ejection_fraction 299 non-null int64 \n 5 high_blood_pressure 299 non-null int64 \n 6 platelets 299 non-null float64\n 7 serum_creatinine 299 non-null float64\n 8 serum_sodium 299 non-null int64 \n 9 sex 299 non-null int64 \n 10 smoking 299 non-null int64 \n 11 time 299 non-null int64 \n 12 DEATH_EVENT 299 non-null int64 \ndtypes: float64(3), int64(10)\nmemory usage: 30.5 KB\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"df.describe()","execution_count":7,"outputs":[{"output_type":"execute_result","execution_count":7,"data":{"text/plain":" age anemia creatinine_phosphokinase diabetes \\\ncount 299.000000 299.000000 299.000000 299.000000 \nmean 60.833893 0.431438 581.839465 0.418060 \nstd 11.894809 0.496107 970.287881 0.494067 \nmin 40.000000 0.000000 23.000000 0.000000 \n25% 51.000000 0.000000 116.500000 0.000000 \n50% 60.000000 0.000000 250.000000 0.000000 \n75% 70.000000 1.000000 582.000000 1.000000 \nmax 95.000000 1.000000 7861.000000 1.000000 \n\n ejection_fraction high_blood_pressure platelets \\\ncount 299.000000 299.000000 299.000000 \nmean 38.083612 0.351171 263358.029264 \nstd 11.834841 0.478136 97804.236869 \nmin 14.000000 0.000000 25100.000000 \n25% 30.000000 0.000000 212500.000000 \n50% 38.000000 0.000000 262000.000000 \n75% 45.000000 1.000000 303500.000000 \nmax 80.000000 1.000000 850000.000000 \n\n serum_creatinine serum_sodium sex smoking time \\\ncount 299.00000 299.000000 299.000000 299.00000 299.000000 \nmean 1.39388 136.625418 0.648829 0.32107 130.260870 \nstd 1.03451 4.412477 0.478136 0.46767 77.614208 \nmin 0.50000 113.000000 0.000000 0.00000 4.000000 \n25% 0.90000 134.000000 0.000000 0.00000 73.000000 \n50% 1.10000 137.000000 1.000000 0.00000 115.000000 \n75% 1.40000 140.000000 1.000000 1.00000 203.000000 \nmax 9.40000 148.000000 1.000000 1.00000 285.000000 \n\n DEATH_EVENT \ncount 299.00000 \nmean 0.32107 \nstd 0.46767 \nmin 0.00000 \n25% 0.00000 \n50% 0.00000 \n75% 1.00000 \nmax 1.00000 ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ageanemiacreatinine_phosphokinasediabetesejection_fractionhigh_blood_pressureplateletsserum_creatinineserum_sodiumsexsmokingtimeDEATH_EVENT
count299.000000299.000000299.000000299.000000299.000000299.000000299.000000299.00000299.000000299.000000299.00000299.000000299.00000
mean60.8338930.431438581.8394650.41806038.0836120.351171263358.0292641.39388136.6254180.6488290.32107130.2608700.32107
std11.8948090.496107970.2878810.49406711.8348410.47813697804.2368691.034514.4124770.4781360.4676777.6142080.46767
min40.0000000.00000023.0000000.00000014.0000000.00000025100.0000000.50000113.0000000.0000000.000004.0000000.00000
25%51.0000000.000000116.5000000.00000030.0000000.000000212500.0000000.90000134.0000000.0000000.0000073.0000000.00000
50%60.0000000.000000250.0000000.00000038.0000000.000000262000.0000001.10000137.0000001.0000000.00000115.0000000.00000
75%70.0000001.000000582.0000001.00000045.0000001.000000303500.0000001.40000140.0000001.0000001.00000203.0000001.00000
max95.0000001.0000007861.0000001.00000080.0000001.000000850000.0000009.40000148.0000001.0000001.00000285.0000001.00000
\n
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"## **MISSING VALUES**\n\nThere are no missing values"},{"metadata":{"trusted":true},"cell_type":"code","source":"missing_percentage=df.isna().sum()*100/df.shape[0]\nmissing_percentage","execution_count":8,"outputs":[{"output_type":"execute_result","execution_count":8,"data":{"text/plain":"age 0.0\nanemia 0.0\ncreatinine_phosphokinase 0.0\ndiabetes 0.0\nejection_fraction 0.0\nhigh_blood_pressure 0.0\nplatelets 0.0\nserum_creatinine 0.0\nserum_sodium 0.0\nsex 0.0\nsmoking 0.0\ntime 0.0\nDEATH_EVENT 0.0\ndtype: float64"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_survived = df.loc[df['DEATH_EVENT'] == 0]\ndf_died = df.loc[df['DEATH_EVENT'] == 1]\n\ndf_cat = df[['anemia', 'diabetes', 'high_blood_pressure', 'sex', 'smoking']]\ndf_cont = df[['age', 'creatinine_phosphokinase', 'ejection_fraction', 'platelets', 'serum_creatinine', 'serum_sodium', 'time']]","execution_count":9,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#PRINT VALUE COUNTS FOR VARIABLES WITH BINARY VALUES:\n\nprint(\"ANEMIA:\")\nprint(df['anemia'].value_counts())\nprint(\"\")\nprint(\"DIABETES:\")\nprint(df['diabetes'].value_counts())\nprint(\"\")\nprint(\"HIGH BLOOD PRESSURE:\")\nprint(df['high_blood_pressure'].value_counts())\nprint(\"\")\nprint(\"SEX:\")\nprint(df['sex'].value_counts())\nprint(\"\")\nprint(\"SMOKING:\")\nprint(df['smoking'].value_counts())\nprint(\"\")\nprint(\"DEATH EVENT:\")\nprint(df['DEATH_EVENT'].value_counts())\nprint(\"\")","execution_count":10,"outputs":[{"output_type":"stream","text":"ANEMIA:\n0 170\n1 129\nName: anemia, dtype: int64\n\nDIABETES:\n0 174\n1 125\nName: diabetes, dtype: int64\n\nHIGH BLOOD PRESSURE:\n0 194\n1 105\nName: high_blood_pressure, dtype: int64\n\nSEX:\n1 194\n0 105\nName: sex, dtype: int64\n\nSMOKING:\n0 203\n1 96\nName: smoking, dtype: int64\n\nDEATH EVENT:\n0 203\n1 96\nName: DEATH_EVENT, dtype: int64\n\n","name":"stdout"}]},{"metadata":{},"cell_type":"markdown","source":"#### GET RANGES OF CONTINUOUS VARIABLES"},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"Range of Age Column: \", df['age'].min(), \"to\", df['age'].max())\nprint(\"\")\nprint(\"Range of Creatinine Phosphokinase Column: \", df['creatinine_phosphokinase'].min(), \"to\", df['creatinine_phosphokinase'].max())\nprint(\"\")\nprint(\"Range of Platelets Column: \", df['platelets'].min(), \"to\", df['platelets'].max())\nprint(\"\")\nprint(\"Range of Serum Creatinine Column: \", df['serum_creatinine'].min(), \"to\", df['serum_creatinine'].max())\nprint(\"\")\nprint(\"Range of Serum Sodium Column: \", df['serum_sodium'].min(), \"to\", df['serum_sodium'].max())\nprint(\"\")\nprint(\"Range of Time Column: \", df['time'].min(), \"to\", df['time'].max())\n\n","execution_count":11,"outputs":[{"output_type":"stream","text":"Range of Age Column: 40.0 to 95.0\n\nRange of Creatinine Phosphokinase Column: 23 to 7861\n\nRange of Platelets Column: 25100.0 to 850000.0\n\nRange of Serum Creatinine Column: 0.5 to 9.4\n\nRange of Serum Sodium Column: 113 to 148\n\nRange of Time Column: 4 to 285\n","name":"stdout"}]},{"metadata":{},"cell_type":"markdown","source":"# III. OUTLIERS\n\nWe'll visualize some of the major outliers and delete the rows that contain them. This will improve the accuracy of our predictive models. "},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.box(df, x=\"creatinine_phosphokinase\")\nfig.update_layout(title_text='CREATININE PHOSPHOKINASE')\nfig.show()","execution_count":12,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","hovertemplate":"creatinine_phosphokinase=%{x}","legendgroup":"","marker":{"color":"#636efa"},"name":"","notched":false,"offsetgroup":"","orientation":"h","showlegend":false,"type":"box","x":[582,7861,146,111,160,47,246,315,157,123,81,231,981,168,80,379,149,582,125,582,52,128,220,63,582,148,112,122,60,70,582,23,249,159,94,582,60,855,2656,235,582,124,571,127,588,582,1380,582,553,129,577,91,3964,69,260,371,75,607,789,364,7702,318,109,582,582,68,250,110,161,113,148,582,5882,224,582,47,92,102,203,336,69,582,76,55,280,78,47,68,84,115,66,897,582,154,144,133,514,59,156,61,305,582,898,5209,53,328,748,1876,936,292,129,60,369,143,754,400,96,102,113,582,737,68,96,582,582,358,168,200,248,270,1808,1082,719,193,4540,582,59,646,281,1548,805,291,482,84,943,185,132,1610,582,2261,233,30,115,1846,335,231,58,250,910,129,72,130,582,2334,2442,776,196,66,582,835,582,3966,171,115,198,95,1419,69,122,835,478,176,395,99,145,104,582,1896,151,244,582,62,121,231,582,418,582,167,582,1211,1767,308,97,59,64,167,101,212,2281,972,212,582,224,131,135,582,1202,427,1021,582,582,118,86,582,582,675,57,2794,56,211,166,93,129,707,582,109,119,232,720,180,81,582,90,1185,582,80,2017,143,624,207,2522,572,245,88,446,191,326,132,66,56,66,655,258,157,582,298,1199,135,582,582,582,582,213,64,257,582,618,582,1051,84,2695,582,64,1688,54,170,253,582,892,337,615,320,190,103,61,1820,2060,2413,196],"x0":" ","xaxis":"x","y0":" ","yaxis":"y"}],"layout":{"boxmode":"group","legend":{"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}}},"title":{"text":"CREATININE PHOSPHOKINASE"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"creatinine_phosphokinase"}},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.box(df, x=\"platelets\")\nfig.update_layout(title_text='PLATELETS')\nfig.show()","execution_count":13,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","hovertemplate":"platelets=%{x}","legendgroup":"","marker":{"color":"#636efa"},"name":"","notched":false,"offsetgroup":"","orientation":"h","showlegend":false,"type":"box","x":[265000,263358.03,162000,210000,327000,204000,127000,454000,263358.03,388000,368000,253000,136000,276000,427000,47000,262000,166000,237000,87000,276000,297000,289000,368000,263358.03,149000,196000,284000,153000,200000,263358.03,360000,319000,302000,188000,228000,226000,321000,305000,329000,263358.03,153000,185000,218000,194000,310000,271000,451000,140000,395000,166000,418000,263358.03,351000,255000,461000,223000,216000,319000,254000,390000,216000,254000,385000,263358.03,119000,213000,274000,244000,497000,374000,122000,243000,149000,266000,204000,317000,237000,283000,324000,293000,263358.03,196000,172000,302000,406000,173000,304000,235000,181000,249000,297000,263358.03,210000,327000,219000,254000,255000,318000,221000,298000,263358.03,149000,226000,286000,621000,263000,226000,304000,850000,306000,228000,252000,351000,328000,164000,271000,507000,203000,263358.03,210000,162000,228000,127000,217000,237000,271000,300000,267000,227000,249000,250000,263358.03,295000,231000,263358.03,172000,305000,221000,211000,263358.03,348000,329000,229000,338000,266000,218000,242000,225000,228000,235000,244000,184000,263358.03,235000,194000,277000,262000,235000,362000,242000,174000,448000,75000,334000,192000,220000,70000,270000,305000,263358.03,325000,176000,189000,281000,337000,105000,132000,267000,279000,303000,221000,265000,224000,219000,389000,153000,365000,201000,275000,350000,309000,260000,160000,126000,223000,263358.03,259000,279000,263358.03,73000,377000,220000,212000,277000,362000,226000,186000,283000,268000,389000,147000,481000,244000,290000,203000,358000,151000,271000,371000,263358.03,194000,365000,130000,504000,265000,189000,141000,237000,274000,62000,185000,255000,330000,305000,406000,248000,173000,257000,263358.03,533000,249000,255000,220000,264000,282000,314000,246000,301000,223000,404000,231000,274000,236000,263358.03,334000,294000,253000,233000,308000,203000,283000,198000,208000,147000,362000,263358.03,133000,302000,222000,263358.03,221000,215000,189000,150000,422000,327000,25100,232000,451000,241000,51000,215000,263358.03,279000,336000,279000,543000,263358.03,390000,222000,133000,382000,179000,155000,270000,742000,140000,395000],"x0":" ","xaxis":"x","y0":" ","yaxis":"y"}],"layout":{"boxmode":"group","legend":{"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}}},"title":{"text":"PLATELETS"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"platelets"}},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.box(df, x=\"serum_creatinine\")\nfig.update_layout(title_text='SERUM CREATININE')\nfig.show()","execution_count":14,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","hovertemplate":"serum_creatinine=%{x}","legendgroup":"","marker":{"color":"#636efa"},"name":"","notched":false,"offsetgroup":"","orientation":"h","showlegend":false,"type":"box","x":[1.9,1.1,1.3,1.9,2.7,2.1,1.2,1.1,1.5,9.4,4,0.9,1.1,1.1,1,1.3,0.9,0.8,1,1.9,1.3,1.6,0.9,0.8,1.83,1.9,1,1.3,5.8,1.2,1.83,3,1,1.2,1,3.5,1,1,2.3,3,1.83,1.2,1.2,1,1.1,1.9,0.9,0.6,4.4,1,1,1.4,6.8,1,2.2,2,2.7,0.6,1.1,1.3,1,2.3,1.1,1,1.18,2.9,1.3,1,1.2,1.83,0.8,0.9,1,1.3,1.2,0.7,0.8,1.2,0.6,0.9,1.7,1.18,2.5,1.8,1,0.7,1.1,0.8,0.7,1.1,0.8,1,1.18,1.7,0.7,1,1.3,1.1,1.2,1.1,1.1,1.18,1.1,1,2.3,1.7,1.3,0.9,1.1,1.3,1.2,1.2,1.6,1.3,1.2,1,0.7,3.2,0.9,1.83,1.5,1,0.75,0.9,3.7,1.3,2.1,0.8,0.7,3.4,0.7,6.1,1.18,1.3,1.18,1.18,0.9,2.1,1,0.8,1.1,0.9,0.9,0.9,1.7,0.7,0.7,1,1.83,0.9,2.5,0.9,0.9,1.18,0.8,1.7,1.4,1,1.3,1.1,1.2,0.8,0.9,0.9,1.1,1.3,0.7,2.4,1,0.8,1.5,0.9,1.1,0.8,0.9,1,1,1,1.2,0.7,0.9,1,1.2,2.5,1.2,1.5,0.6,2.1,1,0.9,2.1,1.5,0.7,1.18,1.6,1.8,1.18,0.8,1,1.8,0.7,1,0.9,3.5,0.7,1,0.8,0.9,1,0.8,1,0.8,1.4,1.6,0.8,1.3,0.9,9,1.1,0.7,1.83,1.1,1.1,0.8,1,1.4,1.3,1,5,1.2,1.7,1.1,0.9,1.4,1.1,1.1,1.1,1.2,1,1.18,1.3,1.3,1.1,0.9,1.8,1.4,1.1,2.4,1,1.2,0.5,0.8,1,1.2,1,1,1.7,1,0.8,0.7,1,0.7,1.4,1,1.2,0.9,1.83,1.7,0.9,1,1.6,0.9,1.2,0.7,1,0.8,1.1,1.1,0.7,1.3,1,2.7,3.8,1.1,0.8,1.2,1.7,1,1.1,0.9,0.8,1.4,1,0.9,1.1,1.2,0.8,1.4,1.6],"x0":" ","xaxis":"x","y0":" ","yaxis":"y"}],"layout":{"boxmode":"group","legend":{"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}}},"title":{"text":"SERUM CREATININE"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"serum_creatinine"}},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.box(df, x=\"serum_sodium\")\nfig.update_layout(title_text='SERUM SODIUM')\nfig.show()","execution_count":15,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","hovertemplate":"serum_sodium=%{x}","legendgroup":"","marker":{"color":"#636efa"},"name":"","notched":false,"offsetgroup":"","orientation":"h","showlegend":false,"type":"box","x":[130,136,129,137,116,132,137,131,138,133,131,140,137,137,138,136,140,127,140,121,137,136,140,135,134,144,138,136,134,132,134,132,128,138,140,134,134,145,137,142,134,136,139,134,142,135,130,138,133,140,138,139,146,134,132,132,138,138,136,136,139,131,139,145,137,127,136,140,142,135,140,139,132,137,134,139,140,140,131,140,136,137,132,133,141,140,137,140,139,144,136,133,137,135,142,141,134,136,137,140,141,137,144,140,143,138,137,138,133,142,132,135,136,137,126,139,136,138,140,134,135,136,140,145,134,135,124,137,136,145,138,131,137,145,137,137,137,130,136,138,134,140,132,141,139,141,136,137,134,136,135,139,134,137,136,140,136,136,134,139,134,139,137,142,139,135,133,134,138,133,136,140,145,139,137,138,135,140,145,140,136,136,136,134,137,136,134,144,136,140,134,135,130,142,135,145,137,138,134,113,137,136,138,136,137,136,141,136,141,130,136,140,138,130,134,134,141,137,134,140,134,145,139,134,138,125,132,140,130,134,127,134,137,137,137,137,148,132,136,137,139,136,136,141,134,137,138,135,142,130,139,143,133,132,139,142,139,139,135,135,138,133,129,140,141,140,134,140,140,132,130,134,133,140,137,137,142,140,136,136,137,136,128,138,141,135,140,132,142,144,141,139,140,136,143,139,138,140,136],"x0":" ","xaxis":"x","y0":" ","yaxis":"y"}],"layout":{"boxmode":"group","legend":{"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}}},"title":{"text":"SERUM SODIUM"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"serum_sodium"}},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"# DROP ROWS WITH OUTLIER VALUES\n\ndf.drop(df[df['creatinine_phosphokinase'] >= 1380].index, inplace = True) \ndf.drop(df[df['platelets'] >= 448000].index, inplace = True) \ndf.drop(df[df['platelets'] <= 73000].index, inplace = True) \ndf.drop(df[df['serum_creatinine'] >= 1.7].index, inplace = True) \ndf.drop(df[df['serum_sodium'] <= 127].index, inplace = True) \ndf.drop(df[df['serum_sodium'] >= 148].index, inplace = True) \n","execution_count":16,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# IV. EXPLORATORY DATA ANALYSIS\n\nIn this section we'll explore our data and create some visualizion to give us further insight. "},{"metadata":{},"cell_type":"markdown","source":"## IVa. UNIVARIATE ANALYSIS\n"},{"metadata":{"trusted":true},"cell_type":"code","source":"values = df['DEATH_EVENT'].value_counts()\n\nfig = make_subplots(rows=1, cols=2, \n specs=[[{\"type\": \"xy\"}, {\"type\": \"domain\"}]],\n subplot_titles=('Death Event Count', 'Death Event Percentage'))\n\nfig.add_trace(go.Bar(y=values, \n name='Death Event Count', \n marker=dict(color=['#2ad4cb','#e6c822'])), row=1, col=1)\n\nfig.add_trace(go.Pie(labels=['Survived','Died'], \n values=values, \n name='Death Event Percentage',\n hole = 0.5,\n marker=dict(colors=['#2ad4cb','#e6c822'])), row=1, col=2)\n\n\nfig.update_layout(height=500, \n title_text='DEATH EVENT STATS',\n showlegend=True)\n\nfig.show()\n","execution_count":17,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"Death Event Count","type":"bar","xaxis":"x","y":[152,45],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":["Survived","Died"],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"Death Event Percentage","type":"pie","values":[152,45]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"Death Event Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"Death Event Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"DEATH EVENT STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"The dataset is very unbalanced with a relatively low number of deaths."},{"metadata":{},"cell_type":"markdown","source":"\n\n### VISUALIZE ALL CATEGORICAL VARIABLES"},{"metadata":{"trusted":true},"cell_type":"code","source":"def plot_cats(feat): \n values = df_cat[feat].value_counts()\n labels = df_cat[feat].value_counts().keys().tolist()\n\n fig = make_subplots(rows=1, cols=2, \n specs=[[{\"type\": \"xy\"}, {\"type\": \"domain\"}]],\n subplot_titles=((feat.title() + ' Count'), (feat.title() + ' Percentage')))\n\n fig.add_trace(go.Bar(y=values, \n name=(feat.title() + ' Count'), \n marker=dict(color=['#2ad4cb','#e6c822'])), row=1, col=1)\n\n fig.add_trace(go.Pie(labels=[labels], \n values=values, \n name=feat.title() + ' Percentage',\n hole = 0.5,\n marker=dict(colors=['#2ad4cb','#e6c822'])), row=1, col=2)\n\n fig.update_layout(height=500, \n title_text=feat.upper() + ' STATS',\n showlegend=True)\n\n fig.show()","execution_count":18,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plot_cats('anemia')","execution_count":19,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"Anemia Count","type":"bar","xaxis":"x","y":[170,129],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":[[0,1]],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"Anemia Percentage","type":"pie","values":[170,129]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"Anemia Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"Anemia Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"ANEMIA STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"plot_cats('diabetes')","execution_count":20,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"Diabetes Count","type":"bar","xaxis":"x","y":[174,125],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":[[0,1]],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"Diabetes Percentage","type":"pie","values":[174,125]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"Diabetes Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"Diabetes Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"DIABETES STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"plot_cats('high_blood_pressure')","execution_count":21,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"High_Blood_Pressure Count","type":"bar","xaxis":"x","y":[194,105],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":[[0,1]],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"High_Blood_Pressure Percentage","type":"pie","values":[194,105]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"High_Blood_Pressure Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"High_Blood_Pressure Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"HIGH_BLOOD_PRESSURE STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"plot_cats('sex')","execution_count":22,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"Sex Count","type":"bar","xaxis":"x","y":[194,105],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":[[1,0]],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"Sex Percentage","type":"pie","values":[194,105]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"Sex Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"Sex Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"SEX STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"plot_cats('smoking')","execution_count":23,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":["#2ad4cb","#e6c822"]},"name":"Smoking Count","type":"bar","xaxis":"x","y":[203,96],"yaxis":"y"},{"domain":{"x":[0.55,1],"y":[0,1]},"hole":0.5,"labels":[[0,1]],"marker":{"colors":["#2ad4cb","#e6c822"]},"name":"Smoking Percentage","type":"pie","values":[203,96]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"Smoking Count","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"Smoking Percentage","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"}],"height":500,"showlegend":true,"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}}},"title":{"text":"SMOKING STATS"},"xaxis":{"anchor":"y","domain":[0,0.45]},"yaxis":{"anchor":"x","domain":[0,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"## IVa. BIVARIATE ANALYSIS\n\n\nIn this section we'll visualize how each categorical and continuous variable correlates with our target variable, \"DEATH EVENT\". "},{"metadata":{},"cell_type":"markdown","source":"\n\n### CATEGORICAL VARIABLES"},{"metadata":{},"cell_type":"markdown","source":"### ANEMIA x DEATH EVENT\n\n**OBSERVATIONS**\n\n* The dataset is closely split between patients both with and without anemia. A small majority of patients (103 or 52.3%) have no anemia. While 97 or 47.7% of patients do have anemia. \n* Patients with anemia are more likely to die than those without. 27.7% of patients with anemia died while 18.4% of patients without anemia died. "},{"metadata":{"trusted":true},"cell_type":"code","source":"df_anemia = df.groupby(['anemia', 'DEATH_EVENT'])[['DEATH_EVENT']].count()\ndf_anemia.columns = ['count']\ndf_anemia.reset_index(inplace=True)\n\nanemia_count = df_anemia.groupby(['anemia'])[['count']].sum()\nanemia_count.reset_index(inplace=True)\n\nnoanemia_death = df_anemia.loc[df_anemia['anemia'] == 0]\nanemia_death = df_anemia.loc[df_anemia['anemia'] == 1]\n\nsubplot_titles=['ANEMIA COUNT', 'ANEMIA x DEATH EVENT COUNT', 'ANEMIA PERCENTAGES', \n 'OVERALL ANEMIA & DEATH EVENT', 'NO ANEMIA x DEATH', 'ANEMIA x DEATH']\n\nfig = make_subplots(rows=3, cols=2, specs=[[{\"type\": \"xy\"}, {\"type\": \"xy\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.13)\n\nlabel1 = ['No Anemia', 'Anemia']\nlabel2 = ['No Anemia: Survived', 'No Anemia: Died', 'Anemia: Survived', 'Anemia: Died']\nlabel3 = ['No Anemia: Survived', 'No Anemia: Died']\nlabel4 = ['Anemia: Survived', 'Anemia: Died']\n\nfig.add_trace(go.Bar(x=label1, y=anemia_count['count'], name='Anemia Count', marker_color='rgb(26, 118, 255)'), row=1, col=1)\nfig.add_trace(go.Bar(x=label2, y=df_anemia['count'], name='Anemia vs Death Event', marker_color='rgb(235, 186, 40)'), row=1, col=2)\nfig.add_trace(go.Pie(labels=label1, values=anemia_count['count']), row=2, col=1)\nfig.add_trace(go.Pie(labels=label2, values=df_anemia['count']), row=2, col=2)\nfig.add_trace(go.Pie(labels=label3, values=noanemia_death['count']), row=3, col=1)\nfig.add_trace(go.Pie(labels=label4, values=anemia_death['count']), row=3, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=1000, showlegend=True, title_text='ANEMIA x DEATH EVENT')\n\nfig.show()","execution_count":24,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":"rgb(26, 118, 255)"},"name":"Anemia Count","type":"bar","x":["No Anemia","Anemia"],"xaxis":"x","y":[103,94],"yaxis":"y"},{"marker":{"color":"rgb(235, 186, 40)"},"name":"Anemia vs Death Event","type":"bar","x":["No Anemia: Survived","No Anemia: Died","Anemia: Survived","Anemia: Died"],"xaxis":"x2","y":[84,19,68,26],"yaxis":"y2"},{"domain":{"x":[0,0.45],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No Anemia","Anemia"],"type":"pie","values":[103,94]},{"domain":{"x":[0.55,1],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No Anemia: Survived","No Anemia: Died","Anemia: Survived","Anemia: Died"],"type":"pie","values":[84,19,68,26]},{"domain":{"x":[0,0.45],"y":[0,0.24666666666666667]},"labels":["No Anemia: Survived","No Anemia: Died"],"type":"pie","values":[84,19]},{"domain":{"x":[0.55,1],"y":[0,0.24666666666666667]},"labels":["Anemia: Survived","Anemia: Died"],"type":"pie","values":[68,26]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"ANEMIA COUNT","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"ANEMIA x DEATH EVENT COUNT","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"ANEMIA PERCENTAGES","x":0.225,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"OVERALL ANEMIA & DEATH EVENT","x":0.775,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"NO ANEMIA x DEATH","x":0.225,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"ANEMIA x DEATH","x":0.775,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"}],"height":1000,"showlegend":true,"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}}},"title":{"text":"ANEMIA x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,0.45]},"xaxis2":{"anchor":"y2","domain":[0.55,1]},"yaxis":{"anchor":"x","domain":[0.7533333333333334,1]},"yaxis2":{"anchor":"x2","domain":[0.7533333333333334,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### DIABETES x DEATH EVENT\n\n**OBSERVATIONS**\n\n* Most patients do not have diabetes, outnumbering patients with diabetes by 29 or about 16%. \n* 113 patients or 57.4% do NOT have diabetes. 84 patients or 42.6% have diabetes. \n* Death rates of patients with diabetes are not signficantly higher than those without. Those with diabetes died at a rate approximately 1.8% higher than those without. "},{"metadata":{"trusted":true},"cell_type":"code","source":"df_diabetes = df.groupby(['diabetes', 'DEATH_EVENT'])[['DEATH_EVENT']].count()\ndf_diabetes.columns = ['count']\ndf_diabetes.reset_index(inplace=True)\n\ndiabetes_count = df_diabetes.groupby(['diabetes'])[['count']].sum()\ndiabetes_count.reset_index(inplace=True)\n\nnodiabetes_death = df_diabetes.loc[df_diabetes['diabetes'] == 0]\ndiabetes_death = df_diabetes.loc[df_diabetes['diabetes'] == 1]\n\nsubplot_titles=['DIABETES COUNT', 'DIABETES x DEATH EVENT COUNT', 'DIABETES PERCENTAGES', \n 'OVERALL DIABETES & DEATH EVENT', 'NO DIABETES x DEATH', 'DIABETES x DEATH']\n\nfig = make_subplots(rows=3, cols=2, specs=[[{\"type\": \"xy\"}, {\"type\": \"xy\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.13)\n\nlabel1 = ['No Diabetes', 'Diabetes']\nlabel2 = ['No Diabetes: Survived', 'No Diabetes: Died', 'Diabetes: Survived', 'Diabetes: Died']\nlabel3 = ['No Diabetes: Survived', 'No Diabetes: Died']\nlabel4 = ['Diabetes: Survived', 'Diabetes: Died']\n\nfig.add_trace(go.Bar(x=label1, y=diabetes_count['count'], name='Diabetes Count', marker_color='rgb(26, 118, 255)'), row=1, col=1)\nfig.add_trace(go.Bar(x=label2, y=df_diabetes['count'], name='Diabetes vs Death Event', marker_color='rgb(235, 186, 40)'), row=1, col=2)\nfig.add_trace(go.Pie(labels=label1, values=diabetes_count['count']), row=2, col=1)\nfig.add_trace(go.Pie(labels=label2, values=df_diabetes['count']), row=2, col=2)\nfig.add_trace(go.Pie(labels=label3, values=nodiabetes_death['count']), row=3, col=1)\nfig.add_trace(go.Pie(labels=label4, values=diabetes_death['count']), row=3, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=1000, showlegend=True, title_text='DIABETES x DEATH EVENT')\n\nfig.show()","execution_count":25,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":"rgb(26, 118, 255)"},"name":"Diabetes Count","type":"bar","x":["No Diabetes","Diabetes"],"xaxis":"x","y":[113,84],"yaxis":"y"},{"marker":{"color":"rgb(235, 186, 40)"},"name":"Diabetes vs Death Event","type":"bar","x":["No Diabetes: Survived","No Diabetes: Died","Diabetes: Survived","Diabetes: Died"],"xaxis":"x2","y":[88,25,64,20],"yaxis":"y2"},{"domain":{"x":[0,0.45],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No Diabetes","Diabetes"],"type":"pie","values":[113,84]},{"domain":{"x":[0.55,1],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No Diabetes: Survived","No Diabetes: Died","Diabetes: Survived","Diabetes: Died"],"type":"pie","values":[88,25,64,20]},{"domain":{"x":[0,0.45],"y":[0,0.24666666666666667]},"labels":["No Diabetes: Survived","No Diabetes: Died"],"type":"pie","values":[88,25]},{"domain":{"x":[0.55,1],"y":[0,0.24666666666666667]},"labels":["Diabetes: Survived","Diabetes: Died"],"type":"pie","values":[64,20]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"DIABETES COUNT","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"DIABETES x DEATH EVENT COUNT","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"DIABETES PERCENTAGES","x":0.225,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"OVERALL DIABETES & DEATH EVENT","x":0.775,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"NO DIABETES x DEATH","x":0.225,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"DIABETES x DEATH","x":0.775,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"}],"height":1000,"showlegend":true,"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}}},"title":{"text":"DIABETES x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,0.45]},"xaxis2":{"anchor":"y2","domain":[0.55,1]},"yaxis":{"anchor":"x","domain":[0.7533333333333334,1]},"yaxis2":{"anchor":"x2","domain":[0.7533333333333334,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### HIGH BLOOD PRESSURE x DEATH EVENT\n\n**OBSERVATIONS**\n\n* Most patients (121 or 61.4%) do not have high blood pressure, while 76 or 38.6% do. \n* Patients with high blood pressure are more likely to die than those without. 27.6% of patients with high blood pressure died while 19.8% of patients without high blood pressure died. "},{"metadata":{"trusted":true},"cell_type":"code","source":"df_hbp = df.groupby(['high_blood_pressure', 'DEATH_EVENT'])[['DEATH_EVENT']].count()\ndf_hbp.columns = ['count']\ndf_hbp.reset_index(inplace=True)\n\nhbp_count = df_hbp.groupby(['high_blood_pressure'])[['count']].sum()\nhbp_count.reset_index(inplace=True)\n\nnohbp_death = df_hbp.loc[df_hbp['high_blood_pressure'] == 0]\nhbp_death = df_hbp.loc[df_hbp['high_blood_pressure'] == 1]\n\nsubplot_titles=['HBP COUNT', 'HBP x DEATH EVENT COUNT', 'HBP PERCENTAGES', \n 'OVERALL HBP & DEATH EVENT', 'NO HBP x DEATH', 'HBP x DEATH']\n\nfig = make_subplots(rows=3, cols=2, specs=[[{\"type\": \"xy\"}, {\"type\": \"xy\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.13)\n\nlabel1 = ['No HBP', 'HBP']\nlabel2 = ['No HBP: Survived', 'No HBP: Died', 'HBP: Survived', 'HBP: Died']\nlabel3 = ['No HBP: Survived', 'No HBP: Died']\nlabel4 = ['HBP: Survived', 'HBP: Died']\n\nfig.add_trace(go.Bar(x=label1, y=hbp_count['count'], name='HBP Count', marker_color='rgb(26, 118, 255)'), row=1, col=1)\nfig.add_trace(go.Bar(x=label2, y=df_hbp['count'], name='HBP vs Death Event', marker_color='rgb(235, 186, 40)'), row=1, col=2)\nfig.add_trace(go.Pie(labels=label1, values=hbp_count['count']), row=2, col=1)\nfig.add_trace(go.Pie(labels=label2, values=df_hbp['count']), row=2, col=2)\nfig.add_trace(go.Pie(labels=label3, values=nohbp_death['count']), row=3, col=1)\nfig.add_trace(go.Pie(labels=label4, values=hbp_death['count']), row=3, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=1000, showlegend=True, title_text='HIGH BLOOD PRESSURE (HBP) x DEATH EVENT')\n\nfig.show()","execution_count":26,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":"rgb(26, 118, 255)"},"name":"HBP Count","type":"bar","x":["No HBP","HBP"],"xaxis":"x","y":[121,76],"yaxis":"y"},{"marker":{"color":"rgb(235, 186, 40)"},"name":"HBP vs Death Event","type":"bar","x":["No HBP: Survived","No HBP: Died","HBP: Survived","HBP: Died"],"xaxis":"x2","y":[97,24,55,21],"yaxis":"y2"},{"domain":{"x":[0,0.45],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No HBP","HBP"],"type":"pie","values":[121,76]},{"domain":{"x":[0.55,1],"y":[0.3766666666666667,0.6233333333333334]},"labels":["No HBP: Survived","No HBP: Died","HBP: Survived","HBP: Died"],"type":"pie","values":[97,24,55,21]},{"domain":{"x":[0,0.45],"y":[0,0.24666666666666667]},"labels":["No HBP: Survived","No HBP: Died"],"type":"pie","values":[97,24]},{"domain":{"x":[0.55,1],"y":[0,0.24666666666666667]},"labels":["HBP: Survived","HBP: Died"],"type":"pie","values":[55,21]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"HBP COUNT","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"HBP x DEATH EVENT COUNT","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"HBP PERCENTAGES","x":0.225,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"OVERALL HBP & DEATH EVENT","x":0.775,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"NO HBP x DEATH","x":0.225,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"HBP x DEATH","x":0.775,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"}],"height":1000,"showlegend":true,"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}}},"title":{"text":"HIGH BLOOD PRESSURE (HBP) x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,0.45]},"xaxis2":{"anchor":"y2","domain":[0.55,1]},"yaxis":{"anchor":"x","domain":[0.7533333333333334,1]},"yaxis2":{"anchor":"x2","domain":[0.7533333333333334,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### SEX x DEATH EVENT\n\n**OBSERVATIONS**\n\n* In this dataset males outnumber females by 11.4% \n* Female patients died at a 1.4% higher rate than males. 23.7% of females died while 22.3% of males died. "},{"metadata":{"trusted":true},"cell_type":"code","source":"df_sex = df.groupby(['sex', 'DEATH_EVENT'])[['DEATH_EVENT']].count()\ndf_sex.columns = ['count']\ndf_sex.reset_index(inplace=True)\n\nsex_count = df_sex.groupby(['sex'])[['count']].sum()\nsex_count.reset_index(inplace=True)\n\nfemale_death = df_sex.loc[df_sex['sex'] == 0]\nmale_death = df_sex.loc[df_sex['sex'] == 1]\n\nsubplot_titles=['SEX COUNT', 'SEX x DEATH EVENT COUNT', 'SEX PERCENTAGES', \n 'OVERALL SEX & DEATH EVENT', 'FEMALE x DEATH', 'MALE x DEATH']\n\nfig = make_subplots(rows=3, cols=2, specs=[[{\"type\": \"xy\"}, {\"type\": \"xy\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.13)\n\nlabel1 = ['Female', 'Male']\nlabel2 = ['Female: Survived', 'Female: Died', 'Male: Survived', 'Male: Died']\nlabel3 = ['Female: Survived', 'Female: Died']\nlabel4 = ['Male: Survived', 'Male: Died']\n\nfig.add_trace(go.Bar(x=label1, y=sex_count['count'], name='Sex Count', marker_color='rgb(26, 118, 255)'), row=1, col=1)\nfig.add_trace(go.Bar(x=label2, y=df_sex['count'], name='Sex vs Death Event', marker_color='rgb(235, 186, 40)'), row=1, col=2)\nfig.add_trace(go.Pie(labels=label1, values=sex_count['count']), row=2, col=1)\nfig.add_trace(go.Pie(labels=label2, values=df_sex['count']), row=2, col=2)\nfig.add_trace(go.Pie(labels=label3, values=female_death['count']), row=3, col=1)\nfig.add_trace(go.Pie(labels=label4, values=male_death['count']), row=3, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=1000, showlegend=True, title_text='SEX x DEATH EVENT')\n\nfig.show()","execution_count":27,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":"rgb(26, 118, 255)"},"name":"Sex Count","type":"bar","x":["Female","Male"],"xaxis":"x","y":[76,121],"yaxis":"y"},{"marker":{"color":"rgb(235, 186, 40)"},"name":"Sex vs Death Event","type":"bar","x":["Female: Survived","Female: Died","Male: Survived","Male: Died"],"xaxis":"x2","y":[58,18,94,27],"yaxis":"y2"},{"domain":{"x":[0,0.45],"y":[0.3766666666666667,0.6233333333333334]},"labels":["Female","Male"],"type":"pie","values":[76,121]},{"domain":{"x":[0.55,1],"y":[0.3766666666666667,0.6233333333333334]},"labels":["Female: Survived","Female: Died","Male: Survived","Male: Died"],"type":"pie","values":[58,18,94,27]},{"domain":{"x":[0,0.45],"y":[0,0.24666666666666667]},"labels":["Female: Survived","Female: Died"],"type":"pie","values":[58,18]},{"domain":{"x":[0.55,1],"y":[0,0.24666666666666667]},"labels":["Male: Survived","Male: Died"],"type":"pie","values":[94,27]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"SEX COUNT","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"SEX x DEATH EVENT COUNT","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"SEX PERCENTAGES","x":0.225,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"OVERALL SEX & DEATH EVENT","x":0.775,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"FEMALE x DEATH","x":0.225,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"MALE x DEATH","x":0.775,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"}],"height":1000,"showlegend":true,"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}}},"title":{"text":"SEX x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,0.45]},"xaxis2":{"anchor":"y2","domain":[0.55,1]},"yaxis":{"anchor":"x","domain":[0.7533333333333334,1]},"yaxis2":{"anchor":"x2","domain":[0.7533333333333334,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### SMOKING x DEATH EVENT\n\n**OBSERVATIONS:** \n\n* Most people in the dataset are non smokers. 131 or 66.5% non smoker, 66 or 33.5% smoker. \n* 24.2% of smokers died. 22.1% of non smokers died. "},{"metadata":{"trusted":true},"cell_type":"code","source":"df_smoking = df.groupby(['smoking', 'DEATH_EVENT'])[['DEATH_EVENT']].count()\ndf_smoking.columns = ['count']\ndf_smoking.reset_index(inplace=True)\n\nsmoking_count = df_smoking.groupby(['smoking'])[['count']].sum()\nsmoking_count.reset_index(inplace=True)\n\nnonsmoking_death = df_smoking.loc[df_smoking['smoking'] == 0]\nsmoking_death = df_smoking.loc[df_smoking['smoking'] == 1]\n\nsubplot_titles=['SMOKING COUNT', 'SMOKING x DEATH EVENT COUNT', 'SMOKING PERCENTAGES', \n 'OVERALL SMOKING & DEATH EVENT', 'NO SMOKING x DEATH', 'SMOKING x DEATH']\n\nfig = make_subplots(rows=3, cols=2, specs=[[{\"type\": \"xy\"}, {\"type\": \"xy\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.13)\n\nlabel1 = ['Non Smoker', 'Smoker']\nlabel2 = ['Non Smoker: Survived', 'Non Smoker: Died', 'Smoker: Survived', 'Smoker: Died']\nlabel3 = ['Non Smoker: Survived', 'Non Smoker: Died']\nlabel4 = ['Smoker: Survived', 'Smoker: Died']\n\nfig.add_trace(go.Bar(x=label1, y=smoking_count['count'], name='Smoker Count', marker_color='rgb(26, 118, 255)'), row=1, col=1)\nfig.add_trace(go.Bar(x=label2, y=df_smoking['count'], name='Smoker vs Death Event', marker_color='rgb(235, 186, 40)'), row=1, col=2)\nfig.add_trace(go.Pie(labels=label1, values=smoking_count['count']), row=2, col=1)\nfig.add_trace(go.Pie(labels=label2, values=df_smoking['count']), row=2, col=2)\nfig.add_trace(go.Pie(labels=label3, values=nonsmoking_death['count']), row=3, col=1)\nfig.add_trace(go.Pie(labels=label4, values=smoking_death['count']), row=3, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=1000, showlegend=True, title_text='SMOKING x DEATH EVENT')\n\nfig.show()","execution_count":28,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"marker":{"color":"rgb(26, 118, 255)"},"name":"Smoker Count","type":"bar","x":["Non Smoker","Smoker"],"xaxis":"x","y":[131,66],"yaxis":"y"},{"marker":{"color":"rgb(235, 186, 40)"},"name":"Smoker vs Death Event","type":"bar","x":["Non Smoker: Survived","Non Smoker: Died","Smoker: Survived","Smoker: Died"],"xaxis":"x2","y":[102,29,50,16],"yaxis":"y2"},{"domain":{"x":[0,0.45],"y":[0.3766666666666667,0.6233333333333334]},"labels":["Non Smoker","Smoker"],"type":"pie","values":[131,66]},{"domain":{"x":[0.55,1],"y":[0.3766666666666667,0.6233333333333334]},"labels":["Non Smoker: Survived","Non Smoker: Died","Smoker: Survived","Smoker: Died"],"type":"pie","values":[102,29,50,16]},{"domain":{"x":[0,0.45],"y":[0,0.24666666666666667]},"labels":["Non Smoker: Survived","Non Smoker: Died"],"type":"pie","values":[102,29]},{"domain":{"x":[0.55,1],"y":[0,0.24666666666666667]},"labels":["Smoker: Survived","Smoker: Died"],"type":"pie","values":[50,16]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"SMOKING COUNT","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"SMOKING x DEATH EVENT COUNT","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"SMOKING PERCENTAGES","x":0.225,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"OVERALL SMOKING & DEATH EVENT","x":0.775,"xanchor":"center","xref":"paper","y":0.6233333333333334,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"NO SMOKING x DEATH","x":0.225,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"SMOKING x DEATH","x":0.775,"xanchor":"center","xref":"paper","y":0.24666666666666667,"yanchor":"bottom","yref":"paper"}],"height":1000,"showlegend":true,"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}}},"title":{"text":"SMOKING x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,0.45]},"xaxis2":{"anchor":"y2","domain":[0.55,1]},"yaxis":{"anchor":"x","domain":[0.7533333333333334,1]},"yaxis2":{"anchor":"x2","domain":[0.7533333333333334,1]}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### CONTINUOUS VARIABLES\n\nThe charts below will display the count of the various continuous variables ('age', 'creatinine_phosphokinase', 'ejection_fraction', 'platelets', 'serum_creatinine', 'serum_sodium', 'time') according to whether or not a patient died or survived. "},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, x=\"age\", \n color=\"DEATH_EVENT\",\n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n nbins=10, hover_data=df.columns) \n\nfig.update_layout(height=500, title_text='AGE x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":29,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
age=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","nbinsx":10,"offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[65,75,65,62,45,50,87,70,65,68,95,70,82,50,65,90,82,50,70,60,57,68,53,70,49,72,45,42,72,70,69,60,59,85,70,80,80,59,65,58,60.667,50,45,48,65],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[65,75,65,62,45,50,87,70,65,68,95,70,82,50,65,90,82,50,70,60,57,68,53,70,49,72,45,42,72,70,69,60,59,85,70,80,80,59,65,58,60.667,50,45,48,65],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
age=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","nbinsx":10,"offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[49,65,53,50,72,60,55,45,41,58,65,70,42,75,55,67,51,55,65,44,57,70,60,42,58,58,63,70,60,63,65,75,80,55,63,55,50,58,60,65,60,66,60,60,43,58,61,46,63,75,65,62,46,50,61,50,52,62,50,65,52,50,85,59,66,45,53,65,70,51,70,50,65,60,49,63,55,40,60.667,40,64,50,73,45,65,50,45,70,78,50,40,85,49,70,50,65,73,70,68,55,65,42,47,58,72,70,40,53,53,77,70,65,55,65,40,73,61,40,53,55,50,70,53,52,58,45,53,55,62,68,61,50,45,40,44,51,67,42,60,45,70,50,50,55,65,90,45,60,52,63,62,50],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[49,65,53,50,72,60,55,45,41,58,65,70,42,75,55,67,51,55,65,44,57,70,60,42,58,58,63,70,60,63,65,75,80,55,63,55,50,58,60,65,60,66,60,60,43,58,61,46,63,75,65,62,46,50,61,50,52,62,50,65,52,50,85,59,66,45,53,65,70,51,70,50,65,60,49,63,55,40,60.667,40,64,50,73,45,65,50,45,70,78,50,40,85,49,70,50,65,73,70,68,55,65,42,47,58,72,70,40,53,53,77,70,65,55,65,40,73,61,40,53,55,50,70,53,52,58,45,53,55,62,68,61,50,45,40,44,51,67,42,60,45,70,50,50,55,65,90,45,60,52,63,62,50],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"AGE x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"age"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, \n x=\"creatinine_phosphokinase\", \n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='CREATININE PHOSPHOKINASE x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":30,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
creatinine_phosphokinase=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[146,246,157,231,981,168,149,125,128,220,112,122,70,249,94,60,855,124,571,588,129,577,91,69,789,364,582,250,110,161,582,47,280,129,143,805,776,176,395,145,104,582,582,131,258],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
creatinine_phosphokinase=%{customdata[2]}
age=%{customdata[0]}
anemia=%{customdata[1]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[146,246,157,231,981,168,149,125,128,220,112,122,70,249,94,60,855,124,571,588,129,577,91,69,789,364,582,250,110,161,582,47,280,129,143,805,776,176,395,145,104,582,582,131,258],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
creatinine_phosphokinase=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[80,52,63,159,127,607,109,582,148,582,224,92,102,203,336,582,78,47,68,84,115,66,897,582,144,133,514,59,156,61,305,582,898,748,936,60,369,400,96,113,737,68,96,582,358,200,248,719,193,582,59,281,291,482,84,185,132,30,115,335,58,250,910,129,72,130,196,582,835,582,171,115,198,95,69,122,835,478,151,244,62,121,231,582,167,582,308,97,64,167,101,212,972,212,582,135,582,1202,1021,582,118,86,582,57,211,93,129,707,582,109,232,720,180,582,90,1185,80,624,207,572,245,88,446,191,132,66,56,66,655,157,582,298,582,582,582,582,213,64,257,582,618,1051,54,170,892,337,615,320,190,103,61,196],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
creatinine_phosphokinase=%{customdata[2]}
age=%{customdata[0]}
anemia=%{customdata[1]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[80,52,63,159,127,607,109,582,148,582,224,92,102,203,336,582,78,47,68,84,115,66,897,582,144,133,514,59,156,61,305,582,898,748,936,60,369,400,96,113,737,68,96,582,358,200,248,719,193,582,59,281,291,482,84,185,132,30,115,335,58,250,910,129,72,130,196,582,835,582,171,115,198,95,69,122,835,478,151,244,62,121,231,582,167,582,308,97,64,167,101,212,972,212,582,135,582,1202,1021,582,118,86,582,57,211,93,129,707,582,109,232,720,180,582,90,1185,80,624,207,572,245,88,446,191,132,66,56,66,655,157,582,298,582,582,582,582,213,64,257,582,618,1051,54,170,892,337,615,320,190,103,61,196],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"CREATININE PHOSPHOKINASE x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"creatinine_phosphokinase"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, \n x=\"ejection_fraction\",\n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='EJECTION FRACTION x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":31,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
ejection_fraction=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[20,15,65,25,30,38,38,25,30,35,40,45,30,35,50,50,50,30,45,60,30,25,20,50,20,20,35,15,25,25,20,20,25,60,60,38,38,25,25,25,30,50,20,30,25],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
ejection_fraction=%{customdata[4]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[20,15,65,25,30,38,38,25,30,35,40,45,30,35,50,50,50,30,45,60,30,25,20,50,20,20,35,15,25,25,20,20,25,60,60,38,38,25,25,25,30,50,20,30,25],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
ejection_fraction=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[30,25,60,30,50,40,35,80,40,35,50,60,40,38,45,50,50,35,60,40,25,45,45,60,38,60,25,60,25,40,25,45,25,45,38,35,25,40,60,60,60,38,38,30,50,60,30,40,60,40,60,35,35,30,40,30,30,60,45,35,35,25,50,45,40,35,60,40,35,35,60,20,35,60,50,60,40,30,40,45,60,40,30,38,30,20,60,60,40,45,40,38,35,17,62,35,35,50,35,35,50,35,25,25,25,35,35,38,45,50,30,40,45,30,35,40,38,35,40,35,45,35,60,30,38,25,50,40,40,60,38,35,38,35,30,40,38,40,30,38,35,30,40,40,35,38,55,35,38,35,38,45],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
ejection_fraction=%{customdata[4]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[30,25,60,30,50,40,35,80,40,35,50,60,40,38,45,50,50,35,60,40,25,45,45,60,38,60,25,60,25,40,25,45,25,45,38,35,25,40,60,60,60,38,38,30,50,60,30,40,60,40,60,35,35,30,40,30,30,60,45,35,35,25,50,45,40,35,60,40,35,35,60,20,35,60,50,60,40,30,40,45,60,40,30,38,30,20,60,60,40,45,40,38,35,17,62,35,35,50,35,35,50,35,25,25,25,35,35,38,45,50,30,40,45,30,35,40,38,35,40,35,45,35,60,30,38,25,50,40,40,60,38,35,38,35,30,40,38,40,30,38,35,30,40,40,35,38,55,35,38,35,38,45],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"EJECTION FRACTION x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"ejection_fraction"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, x=\"platelets\", \n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='PLATELETS x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":32,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
platelets=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[162000,127000,263358.03,253000,136000,276000,262000,237000,297000,289000,196000,284000,200000,319000,188000,226000,321000,153000,185000,194000,395000,166000,418000,351000,319000,254000,385000,213000,274000,244000,266000,204000,302000,306000,351000,263358.03,192000,221000,265000,219000,389000,153000,126000,244000,198000],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
platelets=%{customdata[6]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[162000,127000,263358.03,253000,136000,276000,262000,237000,297000,289000,196000,284000,200000,319000,188000,226000,321000,153000,185000,194000,395000,166000,418000,351000,319000,254000,385000,213000,274000,244000,266000,204000,302000,306000,351000,263358.03,192000,221000,265000,219000,389000,153000,126000,244000,198000],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
platelets=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[427000,276000,368000,302000,218000,216000,254000,263358.03,374000,122000,149000,317000,237000,283000,324000,263358.03,406000,173000,304000,235000,181000,249000,297000,263358.03,327000,219000,254000,255000,318000,221000,298000,263358.03,149000,263000,304000,228000,252000,164000,271000,203000,210000,162000,228000,127000,237000,300000,267000,263358.03,295000,263358.03,172000,221000,348000,329000,229000,266000,218000,244000,184000,235000,277000,262000,235000,362000,242000,174000,220000,270000,305000,263358.03,176000,189000,281000,337000,132000,267000,279000,303000,201000,275000,309000,260000,160000,263358.03,259000,279000,377000,220000,277000,362000,226000,186000,268000,389000,147000,290000,203000,358000,271000,371000,194000,365000,130000,189000,274000,185000,255000,330000,305000,406000,173000,257000,263358.03,249000,255000,220000,282000,301000,223000,231000,274000,236000,263358.03,334000,253000,233000,308000,203000,283000,208000,147000,362000,302000,222000,263358.03,221000,215000,189000,150000,422000,327000,232000,279000,336000,263358.03,390000,222000,133000,382000,179000,155000,395000],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
platelets=%{customdata[6]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[427000,276000,368000,302000,218000,216000,254000,263358.03,374000,122000,149000,317000,237000,283000,324000,263358.03,406000,173000,304000,235000,181000,249000,297000,263358.03,327000,219000,254000,255000,318000,221000,298000,263358.03,149000,263000,304000,228000,252000,164000,271000,203000,210000,162000,228000,127000,237000,300000,267000,263358.03,295000,263358.03,172000,221000,348000,329000,229000,266000,218000,244000,184000,235000,277000,262000,235000,362000,242000,174000,220000,270000,305000,263358.03,176000,189000,281000,337000,132000,267000,279000,303000,201000,275000,309000,260000,160000,263358.03,259000,279000,377000,220000,277000,362000,226000,186000,268000,389000,147000,290000,203000,358000,271000,371000,194000,365000,130000,189000,274000,185000,255000,330000,305000,406000,173000,257000,263358.03,249000,255000,220000,282000,301000,223000,231000,274000,236000,263358.03,334000,253000,233000,308000,203000,283000,208000,147000,362000,302000,222000,263358.03,221000,215000,189000,150000,422000,327000,232000,279000,336000,263358.03,390000,222000,133000,382000,179000,155000,395000],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"PLATELETS x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"platelets"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, \n x=\"serum_creatinine\", \n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='SERUM CREATININE x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":33,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
serum_creatinine=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[1.3,1.2,1.5,0.9,1.1,1.1,0.9,1,1.6,0.9,1,1.3,1.2,1,1,1,1,1.2,1.2,1.1,1,1,1.4,1,1.1,1.3,1,1.3,1,1.2,1.2,0.7,1,1.2,1.3,1.1,1.3,1,1.2,1.2,1.5,0.6,1.6,1.6,1.4],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
serum_creatinine=%{customdata[7]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[1.3,1.2,1.5,0.9,1.1,1.1,0.9,1,1.6,0.9,1,1.3,1.2,1,1,1,1,1.2,1.2,1.1,1,1,1.4,1,1.1,1.3,1,1.3,1,1.2,1.2,0.7,1,1.2,1.3,1.1,1.3,1,1.2,1.2,1.5,0.6,1.6,1.6,1.4],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
serum_creatinine=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[1,1.3,0.8,1.2,1,0.6,1.1,1.18,0.8,0.9,1.3,0.8,1.2,0.6,0.9,1.18,0.7,1.1,0.8,0.7,1.1,0.8,1,1.18,0.7,1,1.3,1.1,1.2,1.1,1.1,1.18,1.1,1.3,1.1,1.2,1.6,1,0.7,0.9,1.5,1,0.75,0.9,1.3,0.8,0.7,1.18,1.3,1.18,0.9,1,0.9,0.9,0.9,0.7,0.7,0.9,0.9,0.8,1.4,1,1.3,1.1,1.2,0.8,0.7,1,0.8,1.5,1.1,0.8,0.9,1,1,1.2,0.7,0.9,1,0.9,1.5,0.7,1.18,1.18,0.8,1,1,0.9,0.7,1,0.8,0.9,0.8,1,0.8,0.8,1.3,0.9,1.1,0.7,1.1,1.1,0.8,1.3,1.2,1.1,0.9,1.4,1.1,1.1,1.2,1,1.18,1.3,1.1,0.9,1.4,1,1.2,0.8,1,1.2,1,1,1,0.8,0.7,1,0.7,1,1.2,0.9,0.9,1,1.6,0.9,1.2,0.7,1,0.8,1.1,0.7,0.8,1.2,1.1,0.9,0.8,1.4,1,0.9,1.1,1.6],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
serum_creatinine=%{customdata[7]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[1,1.3,0.8,1.2,1,0.6,1.1,1.18,0.8,0.9,1.3,0.8,1.2,0.6,0.9,1.18,0.7,1.1,0.8,0.7,1.1,0.8,1,1.18,0.7,1,1.3,1.1,1.2,1.1,1.1,1.18,1.1,1.3,1.1,1.2,1.6,1,0.7,0.9,1.5,1,0.75,0.9,1.3,0.8,0.7,1.18,1.3,1.18,0.9,1,0.9,0.9,0.9,0.7,0.7,0.9,0.9,0.8,1.4,1,1.3,1.1,1.2,0.8,0.7,1,0.8,1.5,1.1,0.8,0.9,1,1,1.2,0.7,0.9,1,0.9,1.5,0.7,1.18,1.18,0.8,1,1,0.9,0.7,1,0.8,0.9,0.8,1,0.8,0.8,1.3,0.9,1.1,0.7,1.1,1.1,0.8,1.3,1.2,1.1,0.9,1.4,1.1,1.1,1.2,1,1.18,1.3,1.1,0.9,1.4,1,1.2,0.8,1,1.2,1,1,1,0.8,0.7,1,0.7,1,1.2,0.9,0.9,1,1.6,0.9,1.2,0.7,1,0.8,1.1,0.7,0.8,1.2,1.1,0.9,0.8,1.4,1,0.9,1.1,1.6],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"SERUM CREATININE x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"serum_creatinine"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, \n x=\"serum_sodium\", \n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='SERUM SODIUM x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":34,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
serum_sodium=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[129,137,138,140,137,137,140,140,136,140,138,136,132,128,140,134,145,136,139,142,140,138,139,134,136,136,145,136,140,142,134,139,141,132,137,134,135,136,136,137,136,134,135,130,129],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
serum_sodium=%{customdata[8]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[129,137,138,140,137,137,140,140,136,140,138,136,132,128,140,134,145,136,139,142,140,138,139,134,136,136,145,136,140,142,134,139,141,132,137,134,135,136,136,137,136,134,135,130,129],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
serum_sodium=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[138,137,135,138,134,138,139,137,140,139,137,140,140,131,140,137,140,137,140,139,144,136,133,137,142,141,134,136,137,140,141,137,144,137,133,135,136,139,136,140,135,136,140,145,135,137,136,137,145,137,137,136,140,132,141,141,136,139,134,136,136,136,134,139,134,139,133,138,133,136,145,139,137,138,140,145,140,136,136,140,135,130,142,137,138,134,136,138,137,136,141,136,130,136,140,134,134,141,134,140,145,139,134,132,134,134,137,137,137,137,132,136,137,136,136,141,137,142,130,143,133,132,139,142,139,135,135,138,133,140,141,140,140,132,130,134,133,140,137,137,142,136,141,135,142,144,141,139,140,136,143,136],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
serum_sodium=%{customdata[8]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
sex=%{customdata[9]}
smoking=%{customdata[10]}
time=%{customdata[11]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[138,137,135,138,134,138,139,137,140,139,137,140,140,131,140,137,140,137,140,139,144,136,133,137,142,141,134,136,137,140,141,137,144,137,133,135,136,139,136,140,135,136,140,145,135,137,136,137,145,137,137,136,140,132,141,141,136,139,134,136,136,136,134,139,134,139,133,138,133,136,145,139,137,138,140,145,140,136,136,140,135,130,142,137,138,134,136,138,137,136,141,136,130,136,140,134,134,141,134,140,145,139,134,132,134,134,137,137,137,137,132,136,137,136,136,141,137,142,130,143,133,132,139,142,139,135,135,138,133,140,141,140,140,132,130,134,133,140,137,137,142,136,141,135,142,144,141,139,140,136,143,136],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"SERUM SODIUM x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"serum_sodium"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig = px.histogram(df, \n x=\"time\", \n color=\"DEATH_EVENT\", \n color_discrete_sequence=['#e6c822','#2ad4cb'],\n marginal=\"box\", \n hover_data=df.columns)\n\nfig.update_layout(height=500, title_text='TIME x DEATH EVENT', showlegend=True)\n\nfig.show()","execution_count":35,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=1
time=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[7,10,10,10,11,11,14,15,20,20,24,26,26,28,29,30,30,32,33,33,42,43,43,44,55,59,61,65,65,66,73,73,78,90,90,109,130,150,154,170,171,172,180,193,235],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[65,0,146,0,20,0,162000,1.3,129,1,1,7,1],[75,1,246,0,15,0,127000,1.2,137,1,0,10,1],[65,0,157,0,65,0,263358.03,1.5,138,0,0,10,1],[62,0,231,0,25,1,253000,0.9,140,1,1,10,1],[45,1,981,0,30,0,136000,1.1,137,1,0,11,1],[50,1,168,0,38,1,276000,1.1,137,1,0,11,1],[87,1,149,0,38,0,262000,0.9,140,1,0,14,1],[70,1,125,0,25,1,237000,1,140,0,0,15,1],[65,1,128,1,30,1,297000,1.6,136,0,0,20,1],[68,1,220,0,35,1,289000,0.9,140,1,1,20,1],[95,1,112,0,40,1,196000,1,138,0,0,24,1],[70,0,122,1,45,1,284000,1.3,136,1,1,26,1],[82,0,70,1,30,0,200000,1.2,132,1,1,26,1],[50,1,249,1,35,1,319000,1,128,0,0,28,1],[65,0,94,1,50,1,188000,1,140,1,0,29,1],[90,1,60,1,50,0,226000,1,134,1,0,30,1],[82,1,855,1,50,1,321000,1,145,0,0,30,1],[50,0,124,1,30,1,153000,1.2,136,0,1,32,1],[70,0,571,1,45,1,185000,1.2,139,1,1,33,1],[60,1,588,1,60,0,194000,1.1,142,0,0,33,1],[57,1,129,0,30,0,395000,1,140,0,0,42,1],[68,1,577,0,25,1,166000,1,138,1,0,43,1],[53,1,91,0,20,1,418000,1.4,139,0,0,43,1],[70,1,69,1,50,1,351000,1,134,0,0,44,1],[49,0,789,0,20,1,319000,1.1,136,1,1,55,1],[72,0,364,1,20,1,254000,1.3,136,1,1,59,1],[45,0,582,0,35,0,385000,1,145,1,0,61,1],[42,1,250,1,15,0,213000,1.3,136,0,0,65,1],[72,1,110,0,25,0,274000,1,140,1,1,65,1],[70,0,161,0,25,0,244000,1.2,142,0,0,66,1],[69,0,582,0,20,0,266000,1.2,134,1,1,73,1],[60,1,47,0,20,0,204000,0.7,139,1,1,73,1],[59,1,280,1,25,1,302000,1,141,0,0,78,1],[85,0,129,0,60,0,306000,1.2,132,1,1,90,1],[70,1,143,0,60,0,351000,1.3,137,0,0,90,1],[80,0,805,0,38,0,263358.03,1.1,134,1,0,109,1],[80,0,776,1,38,1,192000,1.3,135,0,0,130,1],[59,1,176,1,25,0,221000,1,136,1,1,150,1],[65,0,395,1,25,0,265000,1.2,136,1,1,154,1],[58,1,145,0,25,0,219000,1.2,137,1,1,170,1],[60.667,1,104,1,30,0,389000,1.5,136,1,0,171,1],[50,0,582,0,50,0,153000,0.6,134,0,0,172,1],[45,0,582,0,20,1,126000,1.6,135,1,0,180,1],[48,1,131,1,30,1,244000,1.6,130,0,0,193,1],[65,1,258,1,25,0,198000,1.4,129,1,0,235,1]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
time=%{customdata[11]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[7,10,10,10,11,11,14,15,20,20,24,26,26,28,29,30,30,32,33,33,42,43,43,44,55,59,61,65,65,66,73,73,78,90,90,109,130,150,154,170,171,172,180,193,235],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"DEATH_EVENT=0
time=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[12,16,22,29,33,54,60,63,68,71,72,74,74,74,74,76,79,79,79,79,79,80,80,82,83,83,83,85,85,86,87,87,87,88,88,90,90,91,94,94,95,95,95,95,97,104,104,107,107,107,107,108,109,109,110,112,112,117,118,120,120,120,121,121,121,121,134,140,145,145,146,146,146,146,147,147,147,148,172,174,174,175,180,185,186,186,186,186,187,187,187,187,187,188,192,194,195,196,197,197,200,201,201,205,207,208,209,209,209,209,210,210,211,212,212,213,213,214,214,215,215,215,215,216,230,230,231,233,233,237,237,240,244,244,244,244,245,245,245,245,245,246,250,250,256,256,257,258,258,270,270,285],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[49,1,80,0,30,1,427000,1,138,0,0,12,0],[65,1,52,0,25,1,276000,1.3,137,0,0,16,0],[53,0,63,1,60,0,368000,0.8,135,1,0,22,0],[50,1,159,1,30,0,302000,1.2,138,0,0,29,0],[72,0,127,1,50,1,218000,1,134,1,0,33,0],[60,1,607,0,40,0,216000,0.6,138,1,1,54,0],[55,0,109,0,35,0,254000,1.1,139,1,1,60,0],[45,0,582,0,80,0,263358.03,1.18,137,0,0,63,0],[41,0,148,0,40,0,374000,0.8,140,1,1,68,0],[58,0,582,1,35,0,122000,0.9,139,1,1,71,0],[65,0,224,1,50,0,149000,1.3,137,1,1,72,0],[70,0,92,0,60,1,317000,0.8,140,0,1,74,0],[42,0,102,1,40,0,237000,1.2,140,1,0,74,0],[75,1,203,1,38,1,283000,0.6,131,1,1,74,0],[55,0,336,0,45,1,324000,0.9,140,0,0,74,0],[67,0,582,0,50,0,263358.03,1.18,137,1,1,76,0],[51,0,78,0,50,0,406000,0.7,140,1,0,79,0],[55,0,47,0,35,1,173000,1.1,137,1,0,79,0],[65,1,68,1,60,1,304000,0.8,140,1,0,79,0],[44,0,84,1,40,1,235000,0.7,139,1,0,79,0],[57,1,115,0,25,1,181000,1.1,144,1,0,79,0],[70,0,66,1,45,0,249000,0.8,136,1,1,80,0],[60,0,897,1,45,0,297000,1,133,1,0,80,0],[42,0,582,0,60,0,263358.03,1.18,137,0,0,82,0],[58,0,144,1,38,1,327000,0.7,142,0,0,83,0],[58,1,133,0,60,1,219000,1,141,1,0,83,0],[63,1,514,1,25,1,254000,1.3,134,1,0,83,0],[70,1,59,0,60,0,255000,1.1,136,0,0,85,0],[60,1,156,1,25,1,318000,1.2,137,0,0,85,0],[63,1,61,1,40,0,221000,1.1,140,0,0,86,0],[65,1,305,0,25,0,298000,1.1,141,1,0,87,0],[75,0,582,0,45,1,263358.03,1.18,137,1,0,87,0],[80,0,898,0,25,0,149000,1.1,144,1,1,87,0],[55,0,748,0,45,0,263000,1.3,137,1,0,88,0],[63,0,936,0,38,0,304000,1.1,133,1,1,88,0],[55,0,60,0,35,0,228000,1.2,135,1,1,90,0],[50,0,369,1,25,0,252000,1.6,136,1,0,90,0],[58,1,400,0,40,0,164000,1,139,0,0,91,0],[60,1,96,1,60,1,271000,0.7,136,0,0,94,0],[65,1,113,1,60,1,203000,0.9,140,0,0,94,0],[60,1,737,0,60,1,210000,1.5,135,1,1,95,0],[66,1,68,1,38,1,162000,1,136,0,0,95,0],[60,0,96,1,38,0,228000,0.75,140,0,0,95,0],[60,1,582,0,30,1,127000,0.9,145,0,0,95,0],[43,1,358,0,50,0,237000,1.3,135,0,0,97,0],[58,1,200,1,60,0,300000,0.8,137,0,0,104,0],[61,0,248,0,30,1,267000,0.7,136,1,1,104,0],[46,0,719,0,40,1,263358.03,1.18,137,0,0,107,0],[63,0,193,0,60,1,295000,1.3,145,1,1,107,0],[75,0,582,0,40,0,263358.03,1.18,137,1,0,107,0],[65,1,59,1,60,0,172000,0.9,137,0,0,107,0],[62,0,281,1,35,0,221000,1,136,0,0,108,0],[46,1,291,0,35,0,348000,0.9,140,0,0,109,0],[50,0,482,1,30,0,329000,0.9,132,0,0,109,0],[61,1,84,0,40,1,229000,0.9,141,0,0,110,0],[50,0,185,0,30,0,266000,0.7,141,1,1,112,0],[52,0,132,0,30,0,218000,0.7,136,1,1,112,0],[62,0,30,1,60,1,244000,0.9,139,1,0,117,0],[50,0,115,0,45,1,184000,0.9,134,1,1,118,0],[65,1,335,0,35,1,235000,0.8,136,0,0,120,0],[52,1,58,0,35,0,277000,1.4,136,0,0,120,0],[50,0,250,0,25,0,262000,1,136,1,1,120,0],[85,1,910,0,50,0,235000,1.3,134,1,0,121,0],[59,1,129,0,45,1,362000,1.1,139,1,1,121,0],[66,1,72,0,40,1,242000,1.2,134,1,0,121,0],[45,1,130,0,35,0,174000,0.8,139,1,1,121,0],[53,0,196,0,60,0,220000,0.7,133,1,1,134,0],[65,0,582,1,40,0,270000,1,138,0,0,140,0],[70,0,835,0,35,1,305000,0.8,133,0,0,145,0],[51,1,582,1,35,0,263358.03,1.5,136,1,1,145,0],[70,1,171,0,60,1,176000,1.1,145,1,1,146,0],[50,1,115,0,20,0,189000,0.8,139,1,0,146,0],[65,0,198,1,35,1,281000,0.9,137,1,1,146,0],[60,1,95,0,60,0,337000,1,138,1,1,146,0],[49,1,69,0,50,0,132000,1,140,0,0,147,0],[63,1,122,1,60,0,267000,1.2,145,1,0,147,0],[55,0,835,0,40,0,279000,0.7,140,1,1,147,0],[40,0,478,1,30,0,303000,0.9,136,1,0,148,0],[60.667,1,151,1,40,1,201000,1,136,0,0,172,0],[40,0,244,0,45,1,275000,0.9,140,0,0,174,0],[64,1,62,0,60,0,309000,1.5,135,0,0,174,0],[50,1,121,1,40,0,260000,0.7,130,1,0,175,0],[73,1,231,1,30,0,160000,1.18,142,1,1,180,0],[45,0,582,1,38,1,263358.03,1.18,137,0,0,185,0],[65,0,167,0,30,0,259000,0.8,138,0,0,186,0],[50,1,582,1,20,1,279000,1,134,0,0,186,0],[45,0,308,1,60,1,377000,1,136,1,0,186,0],[70,0,97,0,60,1,220000,0.9,138,1,0,186,0],[78,1,64,0,40,0,277000,0.7,137,1,1,187,0],[50,1,167,1,45,0,362000,1,136,0,0,187,0],[40,1,101,0,40,0,226000,0.8,141,0,0,187,0],[85,0,212,0,38,0,186000,0.9,136,1,0,187,0],[49,0,972,1,35,1,268000,0.8,130,0,0,187,0],[70,0,212,1,17,1,389000,1,136,1,1,188,0],[50,0,582,0,62,1,147000,0.8,140,1,1,192,0],[65,1,135,0,35,1,290000,0.8,134,1,0,194,0],[73,0,582,0,35,1,203000,1.3,134,1,0,195,0],[70,0,1202,0,50,1,358000,0.9,141,0,0,196,0],[68,1,1021,1,35,0,271000,1.1,134,1,0,197,0],[55,0,582,1,35,1,371000,0.7,140,0,0,197,0],[65,0,118,0,50,0,194000,1.1,145,1,1,200,0],[42,1,86,0,35,0,365000,1.1,139,1,1,201,0],[47,0,582,0,25,0,130000,0.8,134,1,0,201,0],[58,1,57,0,25,0,189000,1.3,132,1,1,205,0],[72,0,211,0,25,0,274000,1.2,134,0,0,207,0],[70,0,93,0,35,0,185000,1.1,134,1,1,208,0],[40,1,129,0,35,0,255000,0.9,137,1,0,209,0],[53,1,707,0,38,0,330000,1.4,137,1,1,209,0],[53,1,582,0,45,0,305000,1.1,137,1,1,209,0],[77,1,109,0,50,1,406000,1.1,137,1,0,209,0],[70,0,232,0,30,0,173000,1.2,132,1,0,210,0],[65,1,720,1,40,0,257000,1,136,0,0,210,0],[55,1,180,0,45,0,263358.03,1.18,137,1,1,211,0],[65,0,582,1,30,0,249000,1.3,136,1,1,212,0],[40,0,90,0,35,0,255000,1.1,136,1,1,212,0],[73,1,1185,0,40,1,220000,0.9,141,0,0,213,0],[61,1,80,1,38,0,282000,1.4,137,1,0,213,0],[40,0,624,0,35,0,301000,1,142,1,1,214,0],[53,0,207,1,40,0,223000,1.2,130,0,0,214,0],[55,0,572,1,35,0,231000,0.8,143,0,0,215,0],[50,0,245,0,45,1,274000,1,133,1,0,215,0],[70,0,88,1,35,1,236000,1.2,132,0,0,215,0],[53,1,446,0,60,1,263358.03,1,139,1,0,215,0],[52,1,191,1,30,1,334000,1,142,1,1,216,0],[58,0,132,1,38,1,253000,1,139,1,0,230,0],[45,1,66,1,25,0,233000,0.8,135,1,0,230,0],[53,0,56,0,50,0,308000,0.7,135,1,1,231,0],[55,0,66,0,40,0,203000,1,138,1,0,233,0],[62,1,655,0,40,0,283000,0.7,133,0,0,233,0],[68,1,157,1,60,0,208000,1,140,0,0,237,0],[61,0,582,1,38,0,147000,1.2,141,1,0,237,0],[50,1,298,0,35,0,362000,0.9,140,1,1,240,0],[45,0,582,1,38,0,302000,0.9,140,0,0,244,0],[40,0,582,1,35,0,222000,1,132,1,0,244,0],[44,0,582,1,30,1,263358.03,1.6,130,1,1,244,0],[51,0,582,1,40,0,221000,0.9,134,0,0,244,0],[67,0,213,0,38,0,215000,1.2,133,0,0,245,0],[42,0,64,0,40,0,189000,0.7,140,1,0,245,0],[60,1,257,1,30,0,150000,1,137,1,1,245,0],[45,0,582,0,38,1,422000,0.8,137,0,0,245,0],[70,0,618,0,35,0,327000,1.1,142,0,0,245,0],[50,1,1051,1,30,0,232000,0.7,136,0,0,246,0],[50,1,54,0,40,0,279000,0.8,141,1,0,250,0],[55,1,170,1,40,0,336000,1.2,135,1,0,250,0],[65,0,892,1,35,0,263358.03,1.1,142,0,0,256,0],[90,1,337,0,38,0,390000,0.9,144,0,0,256,0],[45,0,615,1,55,0,222000,0.8,141,0,0,257,0],[60,0,320,0,35,0,133000,1.4,139,1,0,258,0],[52,0,190,1,38,0,382000,1,140,1,1,258,0],[63,1,103,1,35,0,179000,0.9,136,1,1,270,0],[62,0,61,1,38,1,155000,1.1,143,1,1,270,0],[50,0,196,0,45,0,395000,1.6,136,1,1,285,0]],"hovertemplate":"DEATH_EVENT=%{customdata[12]}
time=%{customdata[11]}
age=%{customdata[0]}
anemia=%{customdata[1]}
creatinine_phosphokinase=%{customdata[2]}
diabetes=%{customdata[3]}
ejection_fraction=%{customdata[4]}
high_blood_pressure=%{customdata[5]}
platelets=%{customdata[6]}
serum_creatinine=%{customdata[7]}
serum_sodium=%{customdata[8]}
sex=%{customdata[9]}
smoking=%{customdata[10]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[12,16,22,29,33,54,60,63,68,71,72,74,74,74,74,76,79,79,79,79,79,80,80,82,83,83,83,85,85,86,87,87,87,88,88,90,90,91,94,94,95,95,95,95,97,104,104,107,107,107,107,108,109,109,110,112,112,117,118,120,120,120,121,121,121,121,134,140,145,145,146,146,146,146,147,147,147,148,172,174,174,175,180,185,186,186,186,186,187,187,187,187,187,188,192,194,195,196,197,197,200,201,201,205,207,208,209,209,209,209,210,210,211,212,212,213,213,214,214,215,215,215,215,216,230,230,231,233,233,237,237,240,244,244,244,244,245,245,245,245,245,246,250,250,256,256,257,258,258,270,270,285],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"DEATH_EVENT"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"TIME x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"time"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"## IVc. MULTIVARIATE ANALYSIS\n"},{"metadata":{},"cell_type":"markdown","source":"### DEATH & SURVIVAL PERCENTAGES BY SEX & HIGH BLOOD PRESSURE"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_de = df.groupby(['DEATH_EVENT', 'sex', 'high_blood_pressure'])[['age']].count()\ndf_de.reset_index(inplace=True)\ndf_de.rename(columns={'age':'count'}, inplace=True)\n\nsurvived_female = df_de.loc[(df_de['DEATH_EVENT'] == 0) & (df_de['sex'] == 0)]\nsurvived_male = df_de.loc[(df_de['DEATH_EVENT'] == 0) & (df_de['sex'] == 1)]\ndied_female = df_de.loc[(df_de['DEATH_EVENT'] == 1) & (df_de['sex'] == 0)]\ndied_male = df_de.loc[(df_de['DEATH_EVENT'] == 1) & (df_de['sex'] == 1)]\n\nsubplot_titles = ['FEMALE x SURVIVED' , 'MALE x SURVIVED', 'FEMALE x DIED', 'MALE x DIED']\n\nfig = make_subplots(rows=2, cols=2, specs=[[{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles, \n vertical_spacing = 0.10)\n\nlabel = ['No HBP', 'HBP']\n\nfig.add_trace(go.Pie(labels=label, values=survived_female['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=1, col=1)\nfig.add_trace(go.Pie(labels=label, values=survived_male['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=1, col=2)\nfig.add_trace(go.Pie(labels=label, values=died_female['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=2, col=1)\nfig.add_trace(go.Pie(labels=label, values=died_male['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=2, col=2)\n\n# fig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=750, showlegend=True, title_text='DEATH & SURVIVAL PERCENTAGES BY SEX & HIGH BLOOD PRESSURE')\n\nfig.show()","execution_count":36,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"domain":{"x":[0,0.45],"y":[0.55,1]},"hole":0.5,"labels":["No HBP","HBP"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[34,24]},{"domain":{"x":[0.55,1],"y":[0.55,1]},"hole":0.5,"labels":["No HBP","HBP"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[63,31]},{"domain":{"x":[0,0.45],"y":[0,0.45]},"hole":0.5,"labels":["No HBP","HBP"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[7,11]},{"domain":{"x":[0.55,1],"y":[0,0.45]},"hole":0.5,"labels":["No HBP","HBP"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[17,10]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"FEMALE x SURVIVED","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"MALE x SURVIVED","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"FEMALE x DIED","x":0.225,"xanchor":"center","xref":"paper","y":0.45,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"MALE x DIED","x":0.775,"xanchor":"center","xref":"paper","y":0.45,"yanchor":"bottom","yref":"paper"}],"height":750,"showlegend":true,"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}}},"title":{"text":"DEATH & SURVIVAL PERCENTAGES BY SEX & HIGH BLOOD PRESSURE"}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### DEATH & SURVIVAL PERCENTAGES BY SEX & SMOKING STATUS"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_de2 = df.groupby(['DEATH_EVENT', 'sex', 'smoking'])[['age']].count()\ndf_de2.reset_index(inplace=True)\ndf_de2.rename(columns={'age':'count'}, inplace=True)\n\nsurvived_female = df_de2.loc[(df_de2['DEATH_EVENT'] == 0) & (df_de2['sex'] == 0)]\nsurvived_male = df_de2.loc[(df_de2['DEATH_EVENT'] == 0) & (df_de2['sex'] == 1)]\ndied_female = df_de2.loc[(df_de2['DEATH_EVENT'] == 1) & (df_de2['sex'] == 0)]\ndied_male = df_de2.loc[(df_de2['DEATH_EVENT'] == 1) & (df_de2['sex'] == 1)]\n\nsubplot_titles = ['FEMALE x SURVIVED' , 'MALE x SURVIVED', 'FEMALE x DIED', 'MALE x DIED']\n\nfig = make_subplots(rows=2, cols=2, specs=[[{\"type\": \"domain\"}, {\"type\": \"domain\"}],\n [{\"type\": \"domain\"}, {\"type\": \"domain\"}]],\n subplot_titles=subplot_titles,\n vertical_spacing = 0.10)\n\nlabel = ['Non-Smoking', 'Smoking']\n\nfig.add_trace(go.Pie(labels=label, values=survived_female['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822']), rotation=-45), row=1, col=1)\nfig.add_trace(go.Pie(labels=label, values=survived_male['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=1, col=2)\nfig.add_trace(go.Pie(labels=label, values=died_female['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=2, col=1)\nfig.add_trace(go.Pie(labels=label, values=died_male['count'], hole=0.5, marker=dict(colors=['#2ad4cb','#e6c822'])), row=2, col=2)\n\nfig.update_traces(hoverinfo=\"label+name+value\")\nfig.update_layout(height=700, \n showlegend=True, \n margin=dict(t=100, b=0, l=0, r=0),\n title_text='DEATH & SURVIVAL PERCENTAGES BY SEX & SMOKING STATUS')\n\nfig.show()","execution_count":37,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"domain":{"x":[0,0.45],"y":[0.55,1]},"hole":0.5,"hoverinfo":"label+name+value","labels":["Non-Smoking","Smoking"],"marker":{"colors":["#2ad4cb","#e6c822"]},"rotation":-45,"type":"pie","values":[57,1]},{"domain":{"x":[0.55,1],"y":[0.55,1]},"hole":0.5,"hoverinfo":"label+name+value","labels":["Non-Smoking","Smoking"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[45,49]},{"domain":{"x":[0,0.45],"y":[0,0.45]},"hole":0.5,"hoverinfo":"label+name+value","labels":["Non-Smoking","Smoking"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[17,1]},{"domain":{"x":[0.55,1],"y":[0,0.45]},"hole":0.5,"hoverinfo":"label+name+value","labels":["Non-Smoking","Smoking"],"marker":{"colors":["#2ad4cb","#e6c822"]},"type":"pie","values":[12,15]}],"layout":{"annotations":[{"font":{"size":16},"showarrow":false,"text":"FEMALE x SURVIVED","x":0.225,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"MALE x SURVIVED","x":0.775,"xanchor":"center","xref":"paper","y":1,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"FEMALE x DIED","x":0.225,"xanchor":"center","xref":"paper","y":0.45,"yanchor":"bottom","yref":"paper"},{"font":{"size":16},"showarrow":false,"text":"MALE x DIED","x":0.775,"xanchor":"center","xref":"paper","y":0.45,"yanchor":"bottom","yref":"paper"}],"height":700,"margin":{"b":0,"l":0,"r":0,"t":100},"showlegend":true,"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}}},"title":{"text":"DEATH & SURVIVAL PERCENTAGES BY SEX & SMOKING STATUS"}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### SEX & AGE of those who Died"},{"metadata":{"trusted":true},"cell_type":"code","source":"# df_de_age = df.groupby(['DEATH_EVENT', 'sex', 'age'])[['anemia']].count()\n# df_de_age.reset_index(inplace=True)\n# df_de_age.rename(columns={'anemia':'count'}, inplace=True)\n# df_de_age = df_de_age.loc[df_de_age['DEATH_EVENT'] == 1]\n# df_de_age\n\ndf_de1_age = df[['DEATH_EVENT', 'sex', 'age']].loc[df['DEATH_EVENT'] == 1]\ndf_de1_age\n\nfig = px.histogram(df_de1_age, \n x=\"age\", \n color=\"sex\", \n marginal=\"box\",\n color_discrete_sequence=['#e6c822','#2ad4cb'],\n hover_data=df_de1_age.columns)\n\nfig.update_layout(height=500, title_text='SEX & AGE x DEATH EVENT', showlegend=True)\n\nfig.show()\n","execution_count":39,"outputs":[{"output_type":"display_data","data":{"application/vnd.plotly.v1+json":{"config":{"plotlyServerURL":"https://plot.ly"},"data":[{"alignmentgroup":"True","bingroup":"x","hovertemplate":"sex=1
age=%{x}
count=%{y}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","offsetgroup":"1","orientation":"v","showlegend":true,"type":"histogram","x":[65,75,62,45,50,87,68,70,82,65,90,70,68,49,72,45,72,69,60,85,80,59,65,58,60.667,45,65],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[1,1,65],[1,1,75],[1,1,62],[1,1,45],[1,1,50],[1,1,87],[1,1,68],[1,1,70],[1,1,82],[1,1,65],[1,1,90],[1,1,70],[1,1,68],[1,1,49],[1,1,72],[1,1,45],[1,1,72],[1,1,69],[1,1,60],[1,1,85],[1,1,80],[1,1,59],[1,1,65],[1,1,58],[1,1,60.667],[1,1,45],[1,1,65]],"hovertemplate":"sex=%{customdata[1]}
age=%{customdata[2]}
DEATH_EVENT=%{customdata[0]}","legendgroup":"1","marker":{"color":"#e6c822"},"name":"1","notched":true,"offsetgroup":"1","showlegend":false,"type":"box","x":[65,75,62,45,50,87,68,70,82,65,90,70,68,49,72,45,72,69,60,85,80,59,65,58,60.667,45,65],"xaxis":"x2","yaxis":"y2"},{"alignmentgroup":"True","bingroup":"x","hovertemplate":"sex=0
age=%{x}
count=%{y}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","offsetgroup":"0","orientation":"v","showlegend":true,"type":"histogram","x":[65,70,65,95,50,82,50,60,57,53,70,42,70,59,70,80,50,48],"xaxis":"x","yaxis":"y"},{"alignmentgroup":"True","customdata":[[1,0,65],[1,0,70],[1,0,65],[1,0,95],[1,0,50],[1,0,82],[1,0,50],[1,0,60],[1,0,57],[1,0,53],[1,0,70],[1,0,42],[1,0,70],[1,0,59],[1,0,70],[1,0,80],[1,0,50],[1,0,48]],"hovertemplate":"sex=%{customdata[1]}
age=%{customdata[2]}
DEATH_EVENT=%{customdata[0]}","legendgroup":"0","marker":{"color":"#2ad4cb"},"name":"0","notched":true,"offsetgroup":"0","showlegend":false,"type":"box","x":[65,70,65,95,50,82,50,60,57,53,70,42,70,59,70,80,50,48],"xaxis":"x2","yaxis":"y2"}],"layout":{"barmode":"relative","height":500,"legend":{"title":{"text":"sex"},"tracegroupgap":0},"margin":{"t":60},"showlegend":true,"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}}},"title":{"text":"SEX & AGE x DEATH EVENT"},"xaxis":{"anchor":"y","domain":[0,1],"title":{"text":"age"}},"xaxis2":{"anchor":"y2","domain":[0,1],"matches":"x","showgrid":true,"showticklabels":false},"yaxis":{"anchor":"x","domain":[0,0.7326],"title":{"text":"count"}},"yaxis2":{"anchor":"x2","domain":[0.7426,1],"matches":"y2","showgrid":false,"showline":false,"showticklabels":false,"ticks":""}}},"text/html":"
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"### SEX & AGE of the Survivors"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_de0_age = df[['DEATH_EVENT', 'sex', 'age']].loc[df['DEATH_EVENT'] == 0]\ndf_de0_age\n\nfig = px.histogram(df_de0_age, \n x=\"age\", \n color=\"sex\", \n marginal=\"box\",\n color_discrete_sequence=['#e6c822','#2ad4cb'],\n hover_data=df_de0_age.columns)\n\nfig.update_layout(height=500, title_text='SEX & AGE of the Survivors', showlegend=True)\n\nfig.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## DATA NORMALIZATION"},{"metadata":{},"cell_type":"markdown","source":"## MODEL DEVELOPMENT"}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.7.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":4}