{"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\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nimport plotly.express as px\nfrom tqdm import tqdm\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\npd.set_option('display.max_columns', 100)\npd.set_option('display.float_format', '{:.2f}'.format)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv('../input/tabular-playground-series-aug-2022/train.csv', index_col='id')\ntest_df = pd.read_csv('../input/tabular-playground-series-aug-2022/test.csv', index_col='id')\nsub_df = pd.read_csv('../input/tabular-playground-series-aug-2022/sample_submission.csv', index_col='id')\nprint('train data shape: ', train_df.shape)\ndisplay(train_df)\nprint('test data shape: ', test_df.shape)\ndisplay(test_df)\nprint('submission data shape: ', sub_df.shape)\ndisplay(sub_df)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T07:55:13.411256Z","iopub.execute_input":"2022-08-02T07:55:13.411633Z","iopub.status.idle":"2022-08-02T07:55:13.665527Z","shell.execute_reply.started":"2022-08-02T07:55:13.411595Z","shell.execute_reply":"2022-08-02T07:55:13.664487Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('train data Na values:\\n', train_df.isna().sum())\nprint('-'*30, '\\n\\ntest data Na values:\\n', test_df.isna().sum())","metadata":{"execution":{"iopub.status.busy":"2022-08-02T07:55:13.668299Z","iopub.execute_input":"2022-08-02T07:55:13.668746Z","iopub.status.idle":"2022-08-02T07:55:13.688171Z","shell.execute_reply.started":"2022-08-02T07:55:13.668703Z","shell.execute_reply":"2022-08-02T07:55:13.687063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(8, 4))\nplt.xticks(rotation=90)\nplt.title(\"train data's missing values\")\nsns.barplot(x=train_df.isna().sum().index, y=train_df.isna().sum().values)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:04:58.645920Z","iopub.execute_input":"2022-08-02T08:04:58.646769Z","iopub.status.idle":"2022-08-02T08:04:59.027833Z","shell.execute_reply.started":"2022-08-02T08:04:58.646726Z","shell.execute_reply":"2022-08-02T08:04:59.026270Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(8, 4))\nplt.xticks(rotation=90)\nplt.title(\"test data's missing values\")\nsns.barplot(x=test_df.isna().sum().index, y=test_df.isna().sum().values)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:05:06.121073Z","iopub.execute_input":"2022-08-02T08:05:06.121909Z","iopub.status.idle":"2022-08-02T08:05:06.533908Z","shell.execute_reply.started":"2022-08-02T08:05:06.121858Z","shell.execute_reply":"2022-08-02T08:05:06.532479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:06:00.103441Z","iopub.execute_input":"2022-08-02T08:06:00.103874Z","iopub.status.idle":"2022-08-02T08:06:00.128279Z","shell.execute_reply.started":"2022-08-02T08:06:00.103839Z","shell.execute_reply":"2022-08-02T08:06:00.127444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:06:21.070811Z","iopub.execute_input":"2022-08-02T08:06:21.071425Z","iopub.status.idle":"2022-08-02T08:06:21.091120Z","shell.execute_reply.started":"2022-08-02T08:06:21.071377Z","shell.execute_reply":"2022-08-02T08:06:21.090208Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.describe().T\\\n        .style.bar(subset=['mean'], color=px.colors.qualitative.G10[0])\\\n        .background_gradient(subset=['std'], cmap='Greens')\\\n        .background_gradient(subset=['50%'], cmap='BuGn')","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:08:33.808090Z","iopub.execute_input":"2022-08-02T08:08:33.809504Z","iopub.status.idle":"2022-08-02T08:08:33.921366Z","shell.execute_reply.started":"2022-08-02T08:08:33.809448Z","shell.execute_reply":"2022-08-02T08:08:33.918802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.describe().T\\\n        .style.bar(subset=['mean'], color=px.colors.qualitative.G10[0])\\\n        .background_gradient(subset=['std'], cmap='Greens')\\\n        .background_gradient(subset=['50%'], cmap='BuGn')","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:09:22.038491Z","iopub.execute_input":"2022-08-02T08:09:22.038943Z","iopub.status.idle":"2022-08-02T08:09:22.131999Z","shell.execute_reply.started":"2022-08-02T08:09:22.038908Z","shell.execute_reply":"2022-08-02T08:09:22.130839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.select_dtypes(exclude='float64').nunique()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:25:58.929453Z","iopub.execute_input":"2022-08-02T08:25:58.930074Z","iopub.status.idle":"2022-08-02T08:25:58.949380Z","shell.execute_reply.started":"2022-08-02T08:25:58.930039Z","shell.execute_reply":"2022-08-02T08:25:58.948158Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.select_dtypes(exclude='float64').nunique()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:26:34.658771Z","iopub.execute_input":"2022-08-02T08:26:34.659207Z","iopub.status.idle":"2022-08-02T08:26:34.680896Z","shell.execute_reply.started":"2022-08-02T08:26:34.659174Z","shell.execute_reply":"2022-08-02T08:26:34.679701Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(4, 4, figsize=(12, 6))\nplt.tight_layout()\n\nfor i , col in tqdm(zip(range(16), train_df.select_dtypes(include='float64'))):\n    num_row = int((i - (i % 4)) / 4)\n    num_col = i % 4\n    sns.kdeplot(data=train_df, x=col, shade=True, ax=ax[num_row, num_col])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:41:16.541779Z","iopub.execute_input":"2022-08-02T08:41:16.542233Z","iopub.status.idle":"2022-08-02T08:41:20.867025Z","shell.execute_reply.started":"2022-08-02T08:41:16.542197Z","shell.execute_reply":"2022-08-02T08:41:20.865869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(4, 4, figsize=(12, 6))\nplt.tight_layout()\n\nfor i , col in tqdm(zip(range(16), test_df.select_dtypes(include='float64'))):\n    num_row = int((i - (i % 4)) / 4)\n    num_col = i % 4\n    sns.kdeplot(data=test_df, x=col, shade=True, ax=ax[num_row, num_col])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:41:53.024922Z","iopub.execute_input":"2022-08-02T08:41:53.025645Z","iopub.status.idle":"2022-08-02T08:41:57.064046Z","shell.execute_reply.started":"2022-08-02T08:41:53.025607Z","shell.execute_reply":"2022-08-02T08:41:57.063084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(3, 3, figsize=(10, 5))\nplt.tight_layout()\n\nfor i , col in tqdm(zip(range(9), train_df.select_dtypes(exclude='float64'))):\n    num_row = int((i - (i % 3)) / 3)\n    num_col = i % 3\n    sns.countplot(data=train_df, x=col, ax=ax[num_row, num_col])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:44:42.939450Z","iopub.execute_input":"2022-08-02T08:44:42.940674Z","iopub.status.idle":"2022-08-02T08:44:44.403120Z","shell.execute_reply.started":"2022-08-02T08:44:42.940617Z","shell.execute_reply":"2022-08-02T08:44:44.402025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(3, 3, figsize=(10, 5))\nplt.tight_layout()\n\nfor i , col in tqdm(zip(range(9), test_df.select_dtypes(exclude='float64'))):\n    num_row = int((i - (i % 3)) / 3)\n    num_col = i % 3\n    sns.countplot(data=test_df, x=col, ax=ax[num_row, num_col])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:45:10.844833Z","iopub.execute_input":"2022-08-02T08:45:10.845668Z","iopub.status.idle":"2022-08-02T08:45:12.332820Z","shell.execute_reply.started":"2022-08-02T08:45:10.845626Z","shell.execute_reply":"2022-08-02T08:45:12.331940Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax =  plt.subplots(figsize=(10, 10))\n\ncolormap = plt.cm.YlGn\nsns.heatmap(train_df.corr(),\n            annot=True,\n            fmt=\".2f\",\n#             square=False,\n            cmap=colormap,\n            annot_kws={\"size\": 7, 'color': 'black'},\n            cbar_kws={\"shrink\": .4},\n            vmin=-1 ,\n            vmax=1,\n            ax=ax\n           )","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:49:31.833164Z","iopub.execute_input":"2022-08-02T08:49:31.833670Z","iopub.status.idle":"2022-08-02T08:49:34.135374Z","shell.execute_reply.started":"2022-08-02T08:49:31.833630Z","shell.execute_reply":"2022-08-02T08:49:34.134184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax =  plt.subplots(figsize=(10, 10))\n\ncolormap = plt.cm.YlGn\nsns.heatmap(test_df.corr(),\n            annot=True,\n            fmt=\".2f\",\n#             square=False,\n            cmap=colormap,\n            annot_kws={\"size\": 7, 'color': 'black'},\n            cbar_kws={\"shrink\": .4},\n            vmin=-1 ,\n            vmax=1,\n            ax=ax\n           )","metadata":{"execution":{"iopub.status.busy":"2022-08-02T08:49:47.005227Z","iopub.execute_input":"2022-08-02T08:49:47.006079Z","iopub.status.idle":"2022-08-02T08:49:49.090876Z","shell.execute_reply.started":"2022-08-02T08:49:47.005988Z","shell.execute_reply":"2022-08-02T08:49:49.089729Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}