{"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 pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport missingno as msn\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-11T18:50:59.195438Z","iopub.execute_input":"2022-08-11T18:50:59.195854Z","iopub.status.idle":"2022-08-11T18:50:59.203067Z","shell.execute_reply.started":"2022-08-11T18:50:59.195820Z","shell.execute_reply":"2022-08-11T18:50:59.202075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr=pd.read_csv('/kaggle/input/spaceship-titanic/train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:14:50.565970Z","iopub.execute_input":"2022-08-11T18:14:50.566492Z","iopub.status.idle":"2022-08-11T18:14:50.598827Z","shell.execute_reply.started":"2022-08-11T18:14:50.566451Z","shell.execute_reply":"2022-08-11T18:14:50.597700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:51:08.067301Z","iopub.execute_input":"2022-08-11T18:51:08.067718Z","iopub.status.idle":"2022-08-11T18:51:08.095134Z","shell.execute_reply.started":"2022-08-11T18:51:08.067686Z","shell.execute_reply":"2022-08-11T18:51:08.094039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#checking for coloumns\nwarr.columns","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:51:12.497021Z","iopub.execute_input":"2022-08-11T18:51:12.498393Z","iopub.status.idle":"2022-08-11T18:51:12.508391Z","shell.execute_reply.started":"2022-08-11T18:51:12.498345Z","shell.execute_reply":"2022-08-11T18:51:12.506807Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#checking for rows in dataset\nwarr.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:12.694897Z","iopub.execute_input":"2022-08-11T18:52:12.695551Z","iopub.status.idle":"2022-08-11T18:52:12.703450Z","shell.execute_reply.started":"2022-08-11T18:52:12.695486Z","shell.execute_reply":"2022-08-11T18:52:12.701773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.info","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:51:54.479741Z","iopub.execute_input":"2022-08-11T18:51:54.480906Z","iopub.status.idle":"2022-08-11T18:51:54.502192Z","shell.execute_reply.started":"2022-08-11T18:51:54.480864Z","shell.execute_reply":"2022-08-11T18:51:54.500810Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#checking for null values\nmsn.matrix(warr) \nplt.show","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:51:24.674531Z","iopub.execute_input":"2022-08-11T18:51:24.676130Z","iopub.status.idle":"2022-08-11T18:51:26.444506Z","shell.execute_reply.started":"2022-08-11T18:51:24.676078Z","shell.execute_reply":"2022-08-11T18:51:26.443424Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:18.799451Z","iopub.execute_input":"2022-08-11T18:52:18.800662Z","iopub.status.idle":"2022-08-11T18:52:18.815654Z","shell.execute_reply.started":"2022-08-11T18:52:18.800606Z","shell.execute_reply":"2022-08-11T18:52:18.814141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msn.bar(warr)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:51:29.534784Z","iopub.execute_input":"2022-08-11T18:51:29.536286Z","iopub.status.idle":"2022-08-11T18:51:30.605706Z","shell.execute_reply.started":"2022-08-11T18:51:29.536221Z","shell.execute_reply":"2022-08-11T18:51:30.604473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:24.330751Z","iopub.execute_input":"2022-08-11T18:52:24.331738Z","iopub.status.idle":"2022-08-11T18:52:24.355332Z","shell.execute_reply.started":"2022-08-11T18:52:24.331689Z","shell.execute_reply":"2022-08-11T18:52:24.353855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# checking for null values in rows\nwarr['HomePlanet'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:27.729163Z","iopub.execute_input":"2022-08-11T18:52:27.730110Z","iopub.status.idle":"2022-08-11T18:52:27.742104Z","shell.execute_reply.started":"2022-08-11T18:52:27.730057Z","shell.execute_reply":"2022-08-11T18:52:27.740825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['CryoSleep'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:33.155011Z","iopub.execute_input":"2022-08-11T18:52:33.155871Z","iopub.status.idle":"2022-08-11T18:52:33.164754Z","shell.execute_reply.started":"2022-08-11T18:52:33.155830Z","shell.execute_reply":"2022-08-11T18:52:33.163373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Cabin'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:36.835609Z","iopub.execute_input":"2022-08-11T18:52:36.836438Z","iopub.status.idle":"2022-08-11T18:52:36.846119Z","shell.execute_reply.started":"2022-08-11T18:52:36.836385Z","shell.execute_reply":"2022-08-11T18:52:36.844607Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Destination'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:42.558101Z","iopub.execute_input":"2022-08-11T18:52:42.558631Z","iopub.status.idle":"2022-08-11T18:52:42.568455Z","shell.execute_reply.started":"2022-08-11T18:52:42.558593Z","shell.execute_reply":"2022-08-11T18:52:42.567215Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Age'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:45.802147Z","iopub.execute_input":"2022-08-11T18:52:45.803660Z","iopub.status.idle":"2022-08-11T18:52:45.813584Z","shell.execute_reply.started":"2022-08-11T18:52:45.803607Z","shell.execute_reply":"2022-08-11T18:52:45.812501Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['VIP'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:48.633987Z","iopub.execute_input":"2022-08-11T18:52:48.634553Z","iopub.status.idle":"2022-08-11T18:52:48.645774Z","shell.execute_reply.started":"2022-08-11T18:52:48.634511Z","shell.execute_reply":"2022-08-11T18:52:48.644312Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['RoomService'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:55.999919Z","iopub.execute_input":"2022-08-11T18:52:56.000386Z","iopub.status.idle":"2022-08-11T18:52:56.010506Z","shell.execute_reply.started":"2022-08-11T18:52:56.000350Z","shell.execute_reply":"2022-08-11T18:52:56.009517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['FoodCourt'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:52:59.605866Z","iopub.execute_input":"2022-08-11T18:52:59.606340Z","iopub.status.idle":"2022-08-11T18:52:59.615656Z","shell.execute_reply.started":"2022-08-11T18:52:59.606305Z","shell.execute_reply":"2022-08-11T18:52:59.614059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['ShoppingMall'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:02.828284Z","iopub.execute_input":"2022-08-11T18:53:02.828741Z","iopub.status.idle":"2022-08-11T18:53:02.837580Z","shell.execute_reply.started":"2022-08-11T18:53:02.828705Z","shell.execute_reply":"2022-08-11T18:53:02.836594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Spa'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:06.102981Z","iopub.execute_input":"2022-08-11T18:53:06.103494Z","iopub.status.idle":"2022-08-11T18:53:06.113118Z","shell.execute_reply.started":"2022-08-11T18:53:06.103456Z","shell.execute_reply":"2022-08-11T18:53:06.111907Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['VRDeck'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:10.276719Z","iopub.execute_input":"2022-08-11T18:53:10.277183Z","iopub.status.idle":"2022-08-11T18:53:10.286305Z","shell.execute_reply.started":"2022-08-11T18:53:10.277147Z","shell.execute_reply":"2022-08-11T18:53:10.285066Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Name'].isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:13.609786Z","iopub.execute_input":"2022-08-11T18:53:13.610237Z","iopub.status.idle":"2022-08-11T18:53:13.620642Z","shell.execute_reply.started":"2022-08-11T18:53:13.610203Z","shell.execute_reply":"2022-08-11T18:53:13.619336Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:17.593873Z","iopub.execute_input":"2022-08-11T18:53:17.594427Z","iopub.status.idle":"2022-08-11T18:53:17.619824Z","shell.execute_reply.started":"2022-08-11T18:53:17.594380Z","shell.execute_reply":"2022-08-11T18:53:17.618559Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#To find STD Mean and others\nwarr.describe().T","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:21.992610Z","iopub.execute_input":"2022-08-11T18:53:21.993091Z","iopub.status.idle":"2022-08-11T18:53:22.036444Z","shell.execute_reply.started":"2022-08-11T18:53:21.993053Z","shell.execute_reply":"2022-08-11T18:53:22.035347Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#data visualization\nwarr['HomePlanet'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:26.743163Z","iopub.execute_input":"2022-08-11T18:53:26.744465Z","iopub.status.idle":"2022-08-11T18:53:26.754291Z","shell.execute_reply.started":"2022-08-11T18:53:26.744420Z","shell.execute_reply":"2022-08-11T18:53:26.753195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Destination'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:31.932025Z","iopub.execute_input":"2022-08-11T18:53:31.933119Z","iopub.status.idle":"2022-08-11T18:53:31.942650Z","shell.execute_reply.started":"2022-08-11T18:53:31.933082Z","shell.execute_reply":"2022-08-11T18:53:31.941296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['CryoSleep'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:36.717612Z","iopub.execute_input":"2022-08-11T18:53:36.718100Z","iopub.status.idle":"2022-08-11T18:53:36.729467Z","shell.execute_reply.started":"2022-08-11T18:53:36.718061Z","shell.execute_reply":"2022-08-11T18:53:36.728355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['VIP'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:40.092883Z","iopub.execute_input":"2022-08-11T18:53:40.094503Z","iopub.status.idle":"2022-08-11T18:53:40.105311Z","shell.execute_reply.started":"2022-08-11T18:53:40.094446Z","shell.execute_reply":"2022-08-11T18:53:40.104075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Transported'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:44.978003Z","iopub.execute_input":"2022-08-11T18:53:44.978708Z","iopub.status.idle":"2022-08-11T18:53:44.989706Z","shell.execute_reply.started":"2022-08-11T18:53:44.978669Z","shell.execute_reply":"2022-08-11T18:53:44.988528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,9))\nsns.set_palette('dark')\nsns.countplot(x='HomePlanet',data=warr)\nplt.title('Population by Homeplanet')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:53:52.292151Z","iopub.execute_input":"2022-08-11T18:53:52.293353Z","iopub.status.idle":"2022-08-11T18:53:52.506755Z","shell.execute_reply.started":"2022-08-11T18:53:52.293312Z","shell.execute_reply":"2022-08-11T18:53:52.505556Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,9))\nsns.set_palette('pastel')\nsns.countplot(x='HomePlanet',hue='Destination',data=warr)\nplt.title('HomePlanet By The Destination')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:17:30.751710Z","iopub.execute_input":"2022-08-11T18:17:30.752107Z","iopub.status.idle":"2022-08-11T18:17:31.020404Z","shell.execute_reply.started":"2022-08-11T18:17:30.752076Z","shell.execute_reply":"2022-08-11T18:17:31.019175Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:02.097348Z","iopub.execute_input":"2022-08-11T18:55:02.097876Z","iopub.status.idle":"2022-08-11T18:55:02.122170Z","shell.execute_reply.started":"2022-08-11T18:55:02.097835Z","shell.execute_reply":"2022-08-11T18:55:02.120890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,9))\nsns.set_palette('pastel')\nsns.countplot(x='Destination',hue='CryoSleep',data=warr)\nplt.title('Destination By Cryosleep')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:17.614978Z","iopub.execute_input":"2022-08-11T18:55:17.615485Z","iopub.status.idle":"2022-08-11T18:55:17.888918Z","shell.execute_reply.started":"2022-08-11T18:55:17.615445Z","shell.execute_reply":"2022-08-11T18:55:17.887384Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Name'].value_counts().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:22.424376Z","iopub.execute_input":"2022-08-11T18:55:22.424808Z","iopub.status.idle":"2022-08-11T18:55:22.438721Z","shell.execute_reply.started":"2022-08-11T18:55:22.424774Z","shell.execute_reply":"2022-08-11T18:55:22.437651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:25.673951Z","iopub.execute_input":"2022-08-11T18:55:25.674736Z","iopub.status.idle":"2022-08-11T18:55:25.698725Z","shell.execute_reply.started":"2022-08-11T18:55:25.674684Z","shell.execute_reply":"2022-08-11T18:55:25.697337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#find outliers in the coloum\nwarr['Age'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:31.912685Z","iopub.execute_input":"2022-08-11T18:55:31.913132Z","iopub.status.idle":"2022-08-11T18:55:31.923421Z","shell.execute_reply.started":"2022-08-11T18:55:31.913098Z","shell.execute_reply":"2022-08-11T18:55:31.922153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# finding outliers using boxplot\nplt.figure(figsize=(12,6))\nsns.boxplot(warr['Age'])\nplt.title('data with outliers')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:39.154113Z","iopub.execute_input":"2022-08-11T18:55:39.155134Z","iopub.status.idle":"2022-08-11T18:55:39.347832Z","shell.execute_reply.started":"2022-08-11T18:55:39.155096Z","shell.execute_reply":"2022-08-11T18:55:39.346819Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Age'].describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:55:46.677676Z","iopub.execute_input":"2022-08-11T18:55:46.678400Z","iopub.status.idle":"2022-08-11T18:55:46.690488Z","shell.execute_reply.started":"2022-08-11T18:55:46.678351Z","shell.execute_reply":"2022-08-11T18:55:46.689121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Age'].median()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:03.625279Z","iopub.execute_input":"2022-08-11T18:56:03.626071Z","iopub.status.idle":"2022-08-11T18:56:03.634885Z","shell.execute_reply.started":"2022-08-11T18:56:03.626031Z","shell.execute_reply":"2022-08-11T18:56:03.633571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr['Age'].mean()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:09.317004Z","iopub.execute_input":"2022-08-11T18:56:09.317838Z","iopub.status.idle":"2022-08-11T18:56:09.325768Z","shell.execute_reply.started":"2022-08-11T18:56:09.317796Z","shell.execute_reply":"2022-08-11T18:56:09.324813Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def out_bound(space, col):\n    Q1=warr[col].quantile(0.25)\n    Q3=warr[col].quantile(0.75)\n    IQR=Q3-Q1\n    lower_bound=Q1-1.5*IQR\n    upper_bound=Q3+1.5*IQR\n    \n    return lower_bound, upper_bound","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:12.365620Z","iopub.execute_input":"2022-08-11T18:56:12.366097Z","iopub.status.idle":"2022-08-11T18:56:12.372941Z","shell.execute_reply.started":"2022-08-11T18:56:12.366057Z","shell.execute_reply":"2022-08-11T18:56:12.371668Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(out_bound(warr, 'Age'))","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:18:51.300297Z","iopub.execute_input":"2022-08-11T18:18:51.300779Z","iopub.status.idle":"2022-08-11T18:18:51.312302Z","shell.execute_reply.started":"2022-08-11T18:18:51.300733Z","shell.execute_reply":"2022-08-11T18:18:51.311043Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# removing outliers\ndef remove_outliers(data, col):\n    l_b, u_b=out_bound(data, col)\n    \n    return data[ (data[col]>l_b) & (data[col]<u_b) ]","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:24.093375Z","iopub.execute_input":"2022-08-11T18:56:24.094160Z","iopub.status.idle":"2022-08-11T18:56:24.099790Z","shell.execute_reply.started":"2022-08-11T18:56:24.094117Z","shell.execute_reply":"2022-08-11T18:56:24.098826Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"klay=remove_outliers(warr, 'Age')","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:32.725336Z","iopub.execute_input":"2022-08-11T18:56:32.726208Z","iopub.status.idle":"2022-08-11T18:56:32.739599Z","shell.execute_reply.started":"2022-08-11T18:56:32.726146Z","shell.execute_reply":"2022-08-11T18:56:32.738234Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,9))\nsns.boxplot(klay['Age'])\nplt.title('data with removed outliers')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:36.490910Z","iopub.execute_input":"2022-08-11T18:56:36.491698Z","iopub.status.idle":"2022-08-11T18:56:36.629855Z","shell.execute_reply.started":"2022-08-11T18:56:36.491657Z","shell.execute_reply":"2022-08-11T18:56:36.627376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:43.526785Z","iopub.execute_input":"2022-08-11T18:56:43.527501Z","iopub.status.idle":"2022-08-11T18:56:43.546448Z","shell.execute_reply.started":"2022-08-11T18:56:43.527461Z","shell.execute_reply":"2022-08-11T18:56:43.545035Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set_palette('dark')\nplt.figure(figsize=(12,9))\nsns.boxplot(x='HomePlanet', y='Age', data=warr)\nplt.title('Outliers by Homeplanet')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:56:51.894232Z","iopub.execute_input":"2022-08-11T18:56:51.894731Z","iopub.status.idle":"2022-08-11T18:56:52.149641Z","shell.execute_reply.started":"2022-08-11T18:56:51.894692Z","shell.execute_reply":"2022-08-11T18:56:52.148105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:57:14.814415Z","iopub.execute_input":"2022-08-11T18:57:14.814908Z","iopub.status.idle":"2022-08-11T18:57:14.839182Z","shell.execute_reply.started":"2022-08-11T18:57:14.814871Z","shell.execute_reply":"2022-08-11T18:57:14.838266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# visualization on Transported\nplt.figure(figsize=(12,9))\nsns.countplot(x='Transported', hue='Destination', data=warr)\nplt.title('Transported By Destination')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:59:44.562353Z","iopub.execute_input":"2022-08-11T18:59:44.563896Z","iopub.status.idle":"2022-08-11T18:59:44.823510Z","shell.execute_reply.started":"2022-08-11T18:59:44.563836Z","shell.execute_reply":"2022-08-11T18:59:44.822273Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax1 = plt.subplots(figsize=(16, 9))\nsns.set_palette('bright')\nsns.histplot(data = warr, x='Cabin', ax=ax1, bins=25, hue='Transported', kde=True)\nplt.title('Transported By Cabin')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:59:50.741091Z","iopub.execute_input":"2022-08-11T18:59:50.743799Z","iopub.status.idle":"2022-08-11T19:01:17.481592Z","shell.execute_reply.started":"2022-08-11T18:59:50.743727Z","shell.execute_reply":"2022-08-11T19:01:17.480266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax1 = plt.subplots(figsize=(16, 9))\nsns.set_palette('bright')\nsns.histplot(data = warr, x='Age', ax=ax1, bins=25, hue='Transported', kde=True)\nplt.title('Transported By Age')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:01:24.927873Z","iopub.execute_input":"2022-08-11T19:01:24.928340Z","iopub.status.idle":"2022-08-11T19:01:25.386029Z","shell.execute_reply.started":"2022-08-11T19:01:24.928294Z","shell.execute_reply":"2022-08-11T19:01:25.384714Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set_palette('pastel')\nplt.figure(figsize=(12,6))\nsns.countplot(x='HomePlanet', hue='Transported', data=warr)\nplt.title('Transported By HomePlanet')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:01:53.494177Z","iopub.execute_input":"2022-08-11T19:01:53.494646Z","iopub.status.idle":"2022-08-11T19:01:53.738091Z","shell.execute_reply.started":"2022-08-11T19:01:53.494610Z","shell.execute_reply":"2022-08-11T19:01:53.736835Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transported=warr['Transported'].value_counts()\nprint(transported)","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:01.165750Z","iopub.execute_input":"2022-08-11T19:02:01.167120Z","iopub.status.idle":"2022-08-11T19:02:01.174767Z","shell.execute_reply.started":"2022-08-11T19:02:01.167080Z","shell.execute_reply":"2022-08-11T19:02:01.173330Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualization\nlabels=transported.index\nsizes=transported.values\nplt.figure(figsize=(12,9))\ncolors = sns.color_palette('Paired')\nplt.pie(sizes,labels=labels,autopct='%1.1f%%',\n        shadow=True,colors=colors,startangle=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:04.674893Z","iopub.execute_input":"2022-08-11T19:02:04.675358Z","iopub.status.idle":"2022-08-11T19:02:04.827227Z","shell.execute_reply.started":"2022-08-11T19:02:04.675315Z","shell.execute_reply":"2022-08-11T19:02:04.826133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:25.000510Z","iopub.execute_input":"2022-08-11T19:02:25.001768Z","iopub.status.idle":"2022-08-11T19:02:25.026059Z","shell.execute_reply.started":"2022-08-11T19:02:25.001719Z","shell.execute_reply":"2022-08-11T19:02:25.024459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualization\nplt.figure(figsize=(12,9))\nsns.distplot(warr['Age'])\nplt.title('age density')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:29.523960Z","iopub.execute_input":"2022-08-11T19:02:29.524403Z","iopub.status.idle":"2022-08-11T19:02:29.872181Z","shell.execute_reply.started":"2022-08-11T19:02:29.524359Z","shell.execute_reply":"2022-08-11T19:02:29.871010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualtion\nplt.figure(figsize=(12,7))\nsns.set_palette('bright')\nsns.violinplot(x=warr['HomePlanet'],y=warr['Age'])\nplt.title('age by HomePlanet')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:36.740198Z","iopub.execute_input":"2022-08-11T19:02:36.740705Z","iopub.status.idle":"2022-08-11T19:02:37.015943Z","shell.execute_reply.started":"2022-08-11T19:02:36.740668Z","shell.execute_reply":"2022-08-11T19:02:37.014517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"warr.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:55.204450Z","iopub.execute_input":"2022-08-11T19:02:55.205617Z","iopub.status.idle":"2022-08-11T19:02:55.228671Z","shell.execute_reply.started":"2022-08-11T19:02:55.205574Z","shell.execute_reply":"2022-08-11T19:02:55.227073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#finding correlation\nwarr.corr()\n","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:02:58.717205Z","iopub.execute_input":"2022-08-11T19:02:58.717673Z","iopub.status.idle":"2022-08-11T19:02:58.737975Z","shell.execute_reply.started":"2022-08-11T19:02:58.717635Z","shell.execute_reply":"2022-08-11T19:02:58.736528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"corr=warr.corr()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:03:14.007804Z","iopub.execute_input":"2022-08-11T19:03:14.008242Z","iopub.status.idle":"2022-08-11T19:03:14.017512Z","shell.execute_reply.started":"2022-08-11T19:03:14.008207Z","shell.execute_reply":"2022-08-11T19:03:14.016221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualtion on correlation analysis\nplt.figure(figsize=(8,8))\nplt.title('Correlation Analysis',color='Red',fontsize=20,pad=40)\nmask = np.triu(np.ones_like(corr, dtype = bool))\nsns.heatmap(warr.corr(), mask=mask, annot=True, linewidths=.5);\nplt.xticks(rotation=60)\nplt.yticks(rotation = 60)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:03:20.560618Z","iopub.execute_input":"2022-08-11T19:03:20.561418Z","iopub.status.idle":"2022-08-11T19:03:20.947430Z","shell.execute_reply.started":"2022-08-11T19:03:20.561376Z","shell.execute_reply":"2022-08-11T19:03:20.946287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualization\nplt.figure(figsize=(16, 6))\nsns.barplot(x=warr['Age'].value_counts().index, y=warr['Age'].value_counts())\nplt.title('Age')\nplt.xticks(rotation=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:03:45.401047Z","iopub.execute_input":"2022-08-11T19:03:45.401899Z","iopub.status.idle":"2022-08-11T19:03:46.464451Z","shell.execute_reply.started":"2022-08-11T19:03:45.401850Z","shell.execute_reply":"2022-08-11T19:03:46.463331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,6))\nsns.kdeplot(warr[warr['HomePlanet']=='Europa']['Age'], color='purple', label='Europa')\nsns.kdeplot(warr[warr['HomePlanet']=='Earth']['Age'], color='orange', label='Earth')\nsns.kdeplot(warr[warr['HomePlanet']=='Mars']['Age'], color='blue', label='Mars')\nplt.title('Ages by HomePlanlet density')\nplt.xticks(rotation='vertical')\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T19:04:21.265387Z","iopub.execute_input":"2022-08-11T19:04:21.265902Z","iopub.status.idle":"2022-08-11T19:04:21.586394Z","shell.execute_reply.started":"2022-08-11T19:04:21.265864Z","shell.execute_reply":"2022-08-11T19:04:21.585216Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}