{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-02-07T11:05:19.097442Z","iopub.execute_input":"2023-02-07T11:05:19.097972Z","iopub.status.idle":"2023-02-07T11:05:19.122485Z","shell.execute_reply.started":"2023-02-07T11:05:19.097865Z","shell.execute_reply":"2023-02-07T11:05:19.121184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/osic-pulmonary-fibrosis-progression/train.csv')","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:20.278076Z","iopub.execute_input":"2023-02-07T11:05:20.278565Z","iopub.status.idle":"2023-02-07T11:05:20.303403Z","shell.execute_reply.started":"2023-02-07T11:05:20.278521Z","shell.execute_reply":"2023-02-07T11:05:20.302495Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:21.280149Z","iopub.execute_input":"2023-02-07T11:05:21.280655Z","iopub.status.idle":"2023-02-07T11:05:21.309467Z","shell.execute_reply.started":"2023-02-07T11:05:21.280600Z","shell.execute_reply":"2023-02-07T11:05:21.308641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.tail()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:22.161108Z","iopub.execute_input":"2023-02-07T11:05:22.161760Z","iopub.status.idle":"2023-02-07T11:05:22.175910Z","shell.execute_reply.started":"2023-02-07T11:05:22.161725Z","shell.execute_reply":"2023-02-07T11:05:22.174652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.shape","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:22.790702Z","iopub.execute_input":"2023-02-07T11:05:22.791601Z","iopub.status.idle":"2023-02-07T11:05:22.799429Z","shell.execute_reply.started":"2023-02-07T11:05:22.791545Z","shell.execute_reply":"2023-02-07T11:05:22.798136Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.columns","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:23.380663Z","iopub.execute_input":"2023-02-07T11:05:23.381143Z","iopub.status.idle":"2023-02-07T11:05:23.388887Z","shell.execute_reply.started":"2023-02-07T11:05:23.381101Z","shell.execute_reply":"2023-02-07T11:05:23.387574Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.duplicated().sum()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:24.022334Z","iopub.execute_input":"2023-02-07T11:05:24.023405Z","iopub.status.idle":"2023-02-07T11:05:24.039505Z","shell.execute_reply.started":"2023-02-07T11:05:24.023361Z","shell.execute_reply":"2023-02-07T11:05:24.038176Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:24.594346Z","iopub.execute_input":"2023-02-07T11:05:24.595188Z","iopub.status.idle":"2023-02-07T11:05:24.604976Z","shell.execute_reply.started":"2023-02-07T11:05:24.595150Z","shell.execute_reply":"2023-02-07T11:05:24.604065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:25.086103Z","iopub.execute_input":"2023-02-07T11:05:25.086532Z","iopub.status.idle":"2023-02-07T11:05:25.108761Z","shell.execute_reply.started":"2023-02-07T11:05:25.086499Z","shell.execute_reply":"2023-02-07T11:05:25.107472Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:25.671727Z","iopub.execute_input":"2023-02-07T11:05:25.672155Z","iopub.status.idle":"2023-02-07T11:05:25.699082Z","shell.execute_reply.started":"2023-02-07T11:05:25.672122Z","shell.execute_reply":"2023-02-07T11:05:25.698088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.nunique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:26.204183Z","iopub.execute_input":"2023-02-07T11:05:26.204643Z","iopub.status.idle":"2023-02-07T11:05:26.215581Z","shell.execute_reply.started":"2023-02-07T11:05:26.204579Z","shell.execute_reply":"2023-02-07T11:05:26.214654Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1 = df.copy()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:26.679916Z","iopub.execute_input":"2023-02-07T11:05:26.680527Z","iopub.status.idle":"2023-02-07T11:05:26.686606Z","shell.execute_reply.started":"2023-02-07T11:05:26.680495Z","shell.execute_reply":"2023-02-07T11:05:26.684571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\nimport warnings\nwarnings.filterwarnings(\"ignore\")","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:27.254017Z","iopub.execute_input":"2023-02-07T11:05:27.254789Z","iopub.status.idle":"2023-02-07T11:05:27.887510Z","shell.execute_reply.started":"2023-02-07T11:05:27.254747Z","shell.execute_reply":"2023-02-07T11:05:27.886551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Sex'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:27.889467Z","iopub.execute_input":"2023-02-07T11:05:27.890113Z","iopub.status.idle":"2023-02-07T11:05:27.896849Z","shell.execute_reply.started":"2023-02-07T11:05:27.890077Z","shell.execute_reply":"2023-02-07T11:05:27.895683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Sex'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:30.662057Z","iopub.execute_input":"2023-02-07T11:05:30.662545Z","iopub.status.idle":"2023-02-07T11:05:30.672034Z","shell.execute_reply.started":"2023-02-07T11:05:30.662506Z","shell.execute_reply":"2023-02-07T11:05:30.670893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.countplot('Sex', data = df, palette = 'hls')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:31.591710Z","iopub.execute_input":"2023-02-07T11:05:31.592143Z","iopub.status.idle":"2023-02-07T11:05:31.829984Z","shell.execute_reply.started":"2023-02-07T11:05:31.592113Z","shell.execute_reply":"2023-02-07T11:05:31.829137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"label_data = df['Sex'].value_counts()\nexplode = (0.1, 0.1)\nplt.figure(figsize=(14, 10))\npatches, texts, pcts = plt.pie(label_data,\n                                 labels = label_data.index,\n                                 colors = ['blue', 'red'],\n                                 pctdistance = 0.65,\n                                 shadow = True,\n                                 startangle = 90,\n                                 explode = explode,\n                                 autopct = '%1.1f%%',\n                                 textprops={ 'fontsize': 25,\n                                 'color': 'black',\n                                'weight': 'bold',\n                                'family': 'serif' })\nplt.setp(pcts, color='white')\nhfont = {'fontname':'serif', 'weight': 'bold'}\nplt.title('Sex', size=20, **hfont)\ncentre_circle = plt.Circle((0,0),0.40,fc='white')\nfig = plt.gcf()\nfig.gca().add_artist(centre_circle)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:32.184812Z","iopub.execute_input":"2023-02-07T11:05:32.185547Z","iopub.status.idle":"2023-02-07T11:05:32.403385Z","shell.execute_reply.started":"2023-02-07T11:05:32.185507Z","shell.execute_reply":"2023-02-07T11:05:32.401539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['SmokingStatus'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:33.289204Z","iopub.execute_input":"2023-02-07T11:05:33.289639Z","iopub.status.idle":"2023-02-07T11:05:33.298439Z","shell.execute_reply.started":"2023-02-07T11:05:33.289591Z","shell.execute_reply":"2023-02-07T11:05:33.297470Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['SmokingStatus'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:37.746649Z","iopub.execute_input":"2023-02-07T11:05:37.747509Z","iopub.status.idle":"2023-02-07T11:05:37.756604Z","shell.execute_reply.started":"2023-02-07T11:05:37.747465Z","shell.execute_reply":"2023-02-07T11:05:37.755519Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.countplot('SmokingStatus', data = df, palette = 'hls')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:38.224452Z","iopub.execute_input":"2023-02-07T11:05:38.225710Z","iopub.status.idle":"2023-02-07T11:05:38.442893Z","shell.execute_reply.started":"2023-02-07T11:05:38.225654Z","shell.execute_reply":"2023-02-07T11:05:38.441650Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"label_data = df['SmokingStatus'].value_counts()\nexplode = (0.1, 0.1, 0.1)\nplt.figure(figsize=(14, 10))\npatches, texts, pcts = plt.pie(label_data,\n                                 labels = label_data.index,\n                                 colors = ['blue', 'red', 'green'],\n                                 pctdistance = 0.65,\n                                 shadow = True,\n                                 startangle = 90,\n                                 explode = explode,\n                                 autopct = '%1.1f%%',\n                                 textprops={ 'fontsize': 25,\n                                             'color': 'black',\n                                            'weight': 'bold',\n                                            'family': 'serif' }\n                              )\nplt.setp(pcts, color='black')\nhfont = {'fontname':'serif', 'weight': 'bold'}\nplt.title('Smoking Status', size=20, **hfont)\ncentre_circle = plt.Circle((0,0),0.40,fc='white')\nfig = plt.gcf()\nfig.gca().add_artist(centre_circle)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:38.691567Z","iopub.execute_input":"2023-02-07T11:05:38.692062Z","iopub.status.idle":"2023-02-07T11:05:38.931449Z","shell.execute_reply.started":"2023-02-07T11:05:38.692021Z","shell.execute_reply":"2023-02-07T11:05:38.930369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn import preprocessing\nlabel_encoder = preprocessing.LabelEncoder()\ndf['Sex']= label_encoder.fit_transform(df['Sex'])\ndf['SmokingStatus']= label_encoder.fit_transform(df['SmokingStatus'])","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:39.335756Z","iopub.execute_input":"2023-02-07T11:05:39.336192Z","iopub.status.idle":"2023-02-07T11:05:39.482587Z","shell.execute_reply.started":"2023-02-07T11:05:39.336157Z","shell.execute_reply":"2023-02-07T11:05:39.481504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Weeks'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:39.674240Z","iopub.execute_input":"2023-02-07T11:05:39.674739Z","iopub.status.idle":"2023-02-07T11:05:39.683418Z","shell.execute_reply.started":"2023-02-07T11:05:39.674701Z","shell.execute_reply":"2023-02-07T11:05:39.682290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Weeks'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:40.021677Z","iopub.execute_input":"2023-02-07T11:05:40.022152Z","iopub.status.idle":"2023-02-07T11:05:40.032567Z","shell.execute_reply.started":"2023-02-07T11:05:40.022114Z","shell.execute_reply":"2023-02-07T11:05:40.031462Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.countplot('Weeks', data = df, palette = 'hls')\nplt.xticks(rotation = 90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:40.700393Z","iopub.execute_input":"2023-02-07T11:05:40.700857Z","iopub.status.idle":"2023-02-07T11:05:41.908075Z","shell.execute_reply.started":"2023-02-07T11:05:40.700818Z","shell.execute_reply":"2023-02-07T11:05:41.907060Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.histplot(df['Weeks'], bins = 100, kde = True, palette = 'hls')\nplt.xticks(rotation = 90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:41.909728Z","iopub.execute_input":"2023-02-07T11:05:41.910076Z","iopub.status.idle":"2023-02-07T11:05:42.355250Z","shell.execute_reply.started":"2023-02-07T11:05:41.910046Z","shell.execute_reply":"2023-02-07T11:05:42.354071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.scatterplot(data = df, x=\"Weeks\", y=\"Age\", hue ='Sex')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:42.356455Z","iopub.execute_input":"2023-02-07T11:05:42.356820Z","iopub.status.idle":"2023-02-07T11:05:42.731404Z","shell.execute_reply.started":"2023-02-07T11:05:42.356789Z","shell.execute_reply":"2023-02-07T11:05:42.730179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['FVC'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:43.278296Z","iopub.execute_input":"2023-02-07T11:05:43.278959Z","iopub.status.idle":"2023-02-07T11:05:43.285558Z","shell.execute_reply.started":"2023-02-07T11:05:43.278924Z","shell.execute_reply":"2023-02-07T11:05:43.284536Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['FVC'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:43.574684Z","iopub.execute_input":"2023-02-07T11:05:43.575339Z","iopub.status.idle":"2023-02-07T11:05:43.584749Z","shell.execute_reply.started":"2023-02-07T11:05:43.575304Z","shell.execute_reply":"2023-02-07T11:05:43.583452Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.histplot(df['FVC'], bins = 100, kde = True, palette = 'hls')\nplt.xticks(rotation = 90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:43.902743Z","iopub.execute_input":"2023-02-07T11:05:43.903281Z","iopub.status.idle":"2023-02-07T11:05:44.512327Z","shell.execute_reply.started":"2023-02-07T11:05:43.903237Z","shell.execute_reply":"2023-02-07T11:05:44.511498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.scatterplot(data = df, x=\"FVC\", y=\"Percent\", hue ='Age')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:44.638885Z","iopub.execute_input":"2023-02-07T11:05:44.640061Z","iopub.status.idle":"2023-02-07T11:05:45.080537Z","shell.execute_reply.started":"2023-02-07T11:05:44.640017Z","shell.execute_reply":"2023-02-07T11:05:45.079398Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.scatterplot(data = df, x=\"FVC\", y=\"Age\", hue ='Sex')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:45.523318Z","iopub.execute_input":"2023-02-07T11:05:45.524680Z","iopub.status.idle":"2023-02-07T11:05:45.879092Z","shell.execute_reply.started":"2023-02-07T11:05:45.524601Z","shell.execute_reply":"2023-02-07T11:05:45.877770Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.scatterplot(data = df, x=\"FVC\", y=\"Weeks\", hue ='SmokingStatus')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:46.424214Z","iopub.execute_input":"2023-02-07T11:05:46.424711Z","iopub.status.idle":"2023-02-07T11:05:46.816112Z","shell.execute_reply.started":"2023-02-07T11:05:46.424671Z","shell.execute_reply":"2023-02-07T11:05:46.815019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Percent'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:46.818263Z","iopub.execute_input":"2023-02-07T11:05:46.819349Z","iopub.status.idle":"2023-02-07T11:05:46.826748Z","shell.execute_reply.started":"2023-02-07T11:05:46.819309Z","shell.execute_reply":"2023-02-07T11:05:46.825514Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Percent'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:46.999180Z","iopub.execute_input":"2023-02-07T11:05:46.999670Z","iopub.status.idle":"2023-02-07T11:05:47.012737Z","shell.execute_reply.started":"2023-02-07T11:05:46.999629Z","shell.execute_reply":"2023-02-07T11:05:47.011540Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.histplot(df['Percent'], bins = 100, kde = True, palette = 'hls')\nplt.xticks(rotation = 90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:05:47.778739Z","iopub.execute_input":"2023-02-07T11:05:47.779268Z","iopub.status.idle":"2023-02-07T11:05:48.212740Z","shell.execute_reply.started":"2023-02-07T11:05:47.779209Z","shell.execute_reply":"2023-02-07T11:05:48.211497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:07:17.728021Z","iopub.execute_input":"2023-02-07T11:07:17.728474Z","iopub.status.idle":"2023-02-07T11:07:17.745965Z","shell.execute_reply.started":"2023-02-07T11:07:17.728440Z","shell.execute_reply":"2023-02-07T11:07:17.744849Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in df.columns:\n    print(i)","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:13:31.026343Z","iopub.execute_input":"2023-02-07T11:13:31.026836Z","iopub.status.idle":"2023-02-07T11:13:31.033424Z","shell.execute_reply.started":"2023-02-07T11:13:31.026798Z","shell.execute_reply":"2023-02-07T11:13:31.031987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.violinplot(data = df,\n                y='Percent',\n                x='SmokingStatus', \n                hue ='Sex',\n                palette = 'hls')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:27.634026Z","iopub.execute_input":"2023-02-07T11:06:27.634847Z","iopub.status.idle":"2023-02-07T11:06:28.012820Z","shell.execute_reply.started":"2023-02-07T11:06:27.634805Z","shell.execute_reply":"2023-02-07T11:06:28.011595Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.violinplot(data = df, \n                 y='Percent',\n                 x='SmokingStatus',\n                 palette = 'hls')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:31.136970Z","iopub.execute_input":"2023-02-07T11:06:31.138079Z","iopub.status.idle":"2023-02-07T11:06:31.431866Z","shell.execute_reply.started":"2023-02-07T11:06:31.138034Z","shell.execute_reply":"2023-02-07T11:06:31.430760Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.scatterplot(data = df, y='Percent', x='Age', hue = 'SmokingStatus',\n                palette = 'hls')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:32.309967Z","iopub.execute_input":"2023-02-07T11:06:32.311145Z","iopub.status.idle":"2023-02-07T11:06:32.683227Z","shell.execute_reply.started":"2023-02-07T11:06:32.311099Z","shell.execute_reply":"2023-02-07T11:06:32.682302Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1['Patient'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:33.555988Z","iopub.execute_input":"2023-02-07T11:06:33.556687Z","iopub.status.idle":"2023-02-07T11:06:33.564503Z","shell.execute_reply.started":"2023-02-07T11:06:33.556635Z","shell.execute_reply":"2023-02-07T11:06:33.563296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,8))\nsns.histplot(df['Age'], bins = 10, kde = True, palette = 'hls')\nplt.xticks(rotation = 90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:34.426379Z","iopub.execute_input":"2023-02-07T11:06:34.426856Z","iopub.status.idle":"2023-02-07T11:06:34.668127Z","shell.execute_reply.started":"2023-02-07T11:06:34.426814Z","shell.execute_reply":"2023-02-07T11:06:34.667025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16, 6))\nsns.kdeplot(df1.loc[df1['SmokingStatus'] == 'Ex-smoker', 'Age'],\n            label = 'Ex-smoker',shade=True)\nsns.kdeplot(df1.loc[df1['SmokingStatus'] == 'Never smoked', 'Age'],\n            label = 'Never smoked',shade=True)\nsns.kdeplot(df1.loc[df1['SmokingStatus'] == 'Currently smokes', 'Age'],\n            label = 'Currently smokes', shade=True)\nplt.xlabel('Age (years)');\nplt.ylabel('Density');\nplt.title('Distribution of Ages');\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:35.457535Z","iopub.execute_input":"2023-02-07T11:06:35.458586Z","iopub.status.idle":"2023-02-07T11:06:35.683494Z","shell.execute_reply.started":"2023-02-07T11:06:35.458527Z","shell.execute_reply":"2023-02-07T11:06:35.682505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16, 6))\nsns.kdeplot(df1.loc[df1['Sex'] == 'Male', 'Age'], label = 'Male',shade=True)\nsns.kdeplot(df1.loc[df1['Sex'] == 'Female', 'Age'], label = 'Female',shade=True)\nplt.xlabel('Age (years)'); plt.ylabel('Density'); plt.title('Distribution of Ages');\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:36.378132Z","iopub.execute_input":"2023-02-07T11:06:36.379382Z","iopub.status.idle":"2023-02-07T11:06:36.583374Z","shell.execute_reply.started":"2023-02-07T11:06:36.379338Z","shell.execute_reply":"2023-02-07T11:06:36.582035Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16, 6))\na = sns.countplot(data=df1, x='SmokingStatus', hue='Sex')\nfor p in a.patches:\n     a.annotate(format(p.get_height(), ','),\n     (p.get_x() + p.get_width() / 2.,\n     p.get_height()), ha = 'center', va = 'center',\n     xytext = (0, 4), textcoords = 'offset points')\nplt.title('Gender split by SmokingStatus', fontsize=16)\nsns.despine(left=True, bottom=True);","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:37.230306Z","iopub.execute_input":"2023-02-07T11:06:37.230765Z","iopub.status.idle":"2023-02-07T11:06:37.430869Z","shell.execute_reply.started":"2023-02-07T11:06:37.230715Z","shell.execute_reply":"2023-02-07T11:06:37.429677Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"corrmat = df.corr()\nf, ax = plt.subplots(figsize =(9, 8))\nsns.heatmap(corrmat, ax = ax, cmap = 'RdYlBu_r', linewidths = 0.5)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-07T11:06:38.015723Z","iopub.execute_input":"2023-02-07T11:06:38.016740Z","iopub.status.idle":"2023-02-07T11:06:38.296314Z","shell.execute_reply.started":"2023-02-07T11:06:38.016676Z","shell.execute_reply":"2023-02-07T11:06:38.294914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}