{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":30804,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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)\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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2024-12-07T04:52:57.477089Z","iopub.execute_input":"2024-12-07T04:52:57.47747Z","iopub.status.idle":"2024-12-07T04:52:58.537054Z","shell.execute_reply.started":"2024-12-07T04:52:57.477433Z","shell.execute_reply":"2024-12-07T04:52:58.535843Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Importing Essential Libraries","metadata":{}},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:09:10.54065Z","iopub.execute_input":"2024-12-07T05:09:10.541088Z","iopub.status.idle":"2024-12-07T05:09:11.392633Z","shell.execute_reply.started":"2024-12-07T05:09:10.541053Z","shell.execute_reply":"2024-12-07T05:09:11.391475Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Reading Train and Test Set","metadata":{}},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/playground-series-s4e12/train.csv\")\ntest = pd.read_csv(\"/kaggle/input/playground-series-s4e12/test.csv\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T04:58:34.57598Z","iopub.execute_input":"2024-12-07T04:58:34.576291Z","iopub.status.idle":"2024-12-07T04:58:41.299211Z","shell.execute_reply.started":"2024-12-07T04:58:34.576261Z","shell.execute_reply":"2024-12-07T04:58:41.298228Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(f\"No of rows and column in Training Set:{train.shape} and Testing Set:{test.shape}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T04:57:18.846372Z","iopub.execute_input":"2024-12-07T04:57:18.846819Z","iopub.status.idle":"2024-12-07T04:57:18.852512Z","shell.execute_reply.started":"2024-12-07T04:57:18.846743Z","shell.execute_reply":"2024-12-07T04:57:18.851412Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T04:59:05.731112Z","iopub.execute_input":"2024-12-07T04:59:05.73159Z","iopub.status.idle":"2024-12-07T04:59:05.779466Z","shell.execute_reply.started":"2024-12-07T04:59:05.731543Z","shell.execute_reply":"2024-12-07T04:59:05.778542Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:00:10.76879Z","iopub.execute_input":"2024-12-07T05:00:10.769883Z","iopub.status.idle":"2024-12-07T05:00:10.796127Z","shell.execute_reply.started":"2024-12-07T05:00:10.769824Z","shell.execute_reply":"2024-12-07T05:00:10.794875Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Checking Missing Value Percentage","metadata":{}},{"cell_type":"code","source":"print(\"Total no of Missing Values in Train set:\",train.isnull().mean()*100)\nprint(\"---------------\")\nprint(\"Total no of Missing Values in Test set:\",test.isnull().mean()*100)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:02:59.50307Z","iopub.execute_input":"2024-12-07T05:02:59.503462Z","iopub.status.idle":"2024-12-07T05:03:00.557558Z","shell.execute_reply.started":"2024-12-07T05:02:59.503421Z","shell.execute_reply":"2024-12-07T05:03:00.556563Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(\"No of Duplicated Rows in Training Set:\",train.duplicated().sum())\nprint(\"No of Duplicated Rows in Test Set:\",test.duplicated().sum())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:06:35.500735Z","iopub.execute_input":"2024-12-07T05:06:35.501167Z","iopub.status.idle":"2024-12-07T05:06:38.116738Z","shell.execute_reply.started":"2024-12-07T05:06:35.501133Z","shell.execute_reply":"2024-12-07T05:06:38.115732Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# EDA  (Exploratory Data Analysis)","metadata":{}},{"cell_type":"code","source":"sns.kdeplot(x='Premium Amount',data=train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:09:54.404562Z","iopub.execute_input":"2024-12-07T05:09:54.405092Z","iopub.status.idle":"2024-12-07T05:09:59.568021Z","shell.execute_reply.started":"2024-12-07T05:09:54.405055Z","shell.execute_reply":"2024-12-07T05:09:59.567027Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sns.boxplot(x='Gender',y='Premium Amount',data=train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:12:01.131831Z","iopub.execute_input":"2024-12-07T05:12:01.132253Z","iopub.status.idle":"2024-12-07T05:12:02.047422Z","shell.execute_reply.started":"2024-12-07T05:12:01.132215Z","shell.execute_reply":"2024-12-07T05:12:02.04637Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Data is balanced across the genders","metadata":{}},{"cell_type":"code","source":"sns.boxplot(x='Marital Status',y='Premium Amount',data=train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:15:08.731669Z","iopub.execute_input":"2024-12-07T05:15:08.732073Z","iopub.status.idle":"2024-12-07T05:15:09.679438Z","shell.execute_reply.started":"2024-12-07T05:15:08.732035Z","shell.execute_reply":"2024-12-07T05:15:09.678358Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sns.boxplot(x='Number of Dependents',y='Premium Amount',data=train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-07T05:15:43.817581Z","iopub.execute_input":"2024-12-07T05:15:43.818284Z","iopub.status.idle":"2024-12-07T05:15:44.357794Z","shell.execute_reply.started":"2024-12-07T05:15:43.818243Z","shell.execute_reply":"2024-12-07T05:15:44.356697Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"From above charts we can conclude that the distribution across *Marital Status and Number of Dependent* are normally distributed","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}