{"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":"# 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","execution":{"iopub.status.busy":"2022-07-31T06:04:16.012113Z","iopub.execute_input":"2022-07-31T06:04:16.013213Z","iopub.status.idle":"2022-07-31T06:04:16.046247Z","shell.execute_reply.started":"2022-07-31T06:04:16.013097Z","shell.execute_reply":"2022-07-31T06:04:16.045088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train=pd.read_csv('/kaggle/input/titanic/train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:05:44.016158Z","iopub.execute_input":"2022-07-31T06:05:44.016623Z","iopub.status.idle":"2022-07-31T06:05:44.028202Z","shell.execute_reply.started":"2022-07-31T06:05:44.016588Z","shell.execute_reply":"2022-07-31T06:05:44.027073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:05:59.507372Z","iopub.execute_input":"2022-07-31T06:05:59.507813Z","iopub.status.idle":"2022-07-31T06:05:59.533570Z","shell.execute_reply.started":"2022-07-31T06:05:59.507778Z","shell.execute_reply":"2022-07-31T06:05:59.532284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:06:21.178210Z","iopub.execute_input":"2022-07-31T06:06:21.178640Z","iopub.status.idle":"2022-07-31T06:06:21.192324Z","shell.execute_reply.started":"2022-07-31T06:06:21.178604Z","shell.execute_reply":"2022-07-31T06:06:21.191122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Exploratory Data Analysis:\n\nMissing Data : I will use seaborn to represent missing data","metadata":{}},{"cell_type":"code","source":"import seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:09:10.933537Z","iopub.execute_input":"2022-07-31T06:09:10.934401Z","iopub.status.idle":"2022-07-31T06:09:11.469429Z","shell.execute_reply.started":"2022-07-31T06:09:10.934362Z","shell.execute_reply":"2022-07-31T06:09:11.468336Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(df_train.isnull(),yticklabels=False,cbar=False,cmap='viridis')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:10:29.873014Z","iopub.execute_input":"2022-07-31T06:10:29.873474Z","iopub.status.idle":"2022-07-31T06:10:30.068760Z","shell.execute_reply.started":"2022-07-31T06:10:29.873416Z","shell.execute_reply":"2022-07-31T06:10:30.067527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Age and cabin is having null values, The proportion of Age missing is likely small enough for reasonable replacement with some form of imputation. Looking at the Cabin column, it looks like we are just missing too much of that data to do something useful with at a basic level. We'll probably drop this later, or change it to another feature like \"Cabin Known: 1 or 0\"","metadata":{}},{"cell_type":"code","source":"sns.set_style('whitegrid')\nsns.countplot(x='Survived',data=df_train,palette='RdBu_r')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:12:56.853928Z","iopub.execute_input":"2022-07-31T06:12:56.854962Z","iopub.status.idle":"2022-07-31T06:12:57.027240Z","shell.execute_reply.started":"2022-07-31T06:12:56.854917Z","shell.execute_reply":"2022-07-31T06:12:57.026343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set_style('whitegrid')\nsns.countplot('Survived',hue='Sex',data =df_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:14:46.037610Z","iopub.execute_input":"2022-07-31T06:14:46.038047Z","iopub.status.idle":"2022-07-31T06:14:46.189370Z","shell.execute_reply.started":"2022-07-31T06:14:46.038013Z","shell.execute_reply":"2022-07-31T06:14:46.188023Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set_style('whitegrid')\nsns.countplot('Survived',hue='Pclass',data =df_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:17:14.643758Z","iopub.execute_input":"2022-07-31T06:17:14.644159Z","iopub.status.idle":"2022-07-31T06:17:14.859574Z","shell.execute_reply.started":"2022-07-31T06:17:14.644124Z","shell.execute_reply":"2022-07-31T06:17:14.858524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(df_train['Age'].dropna(),kde=False,color='darkred',bins=50)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:18:00.631946Z","iopub.execute_input":"2022-07-31T06:18:00.632345Z","iopub.status.idle":"2022-07-31T06:18:00.949072Z","shell.execute_reply.started":"2022-07-31T06:18:00.632311Z","shell.execute_reply":"2022-07-31T06:18:00.948038Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x='SibSp',data=df_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:18:51.084262Z","iopub.execute_input":"2022-07-31T06:18:51.085292Z","iopub.status.idle":"2022-07-31T06:18:51.297648Z","shell.execute_reply.started":"2022-07-31T06:18:51.085238Z","shell.execute_reply":"2022-07-31T06:18:51.296420Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train['Fare'].hist(color='green',bins=40,figsize=(8,4))","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:19:18.198939Z","iopub.execute_input":"2022-07-31T06:19:18.199329Z","iopub.status.idle":"2022-07-31T06:19:18.495052Z","shell.execute_reply.started":"2022-07-31T06:19:18.199295Z","shell.execute_reply":"2022-07-31T06:19:18.494298Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Data Cleaning\n","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"import matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:21:26.862419Z","iopub.execute_input":"2022-07-31T06:21:26.862937Z","iopub.status.idle":"2022-07-31T06:21:26.870344Z","shell.execute_reply.started":"2022-07-31T06:21:26.862896Z","shell.execute_reply":"2022-07-31T06:21:26.868686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,8))\nsns.boxplot(x='Pclass',y='Age',data = df_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:22:58.647313Z","iopub.execute_input":"2022-07-31T06:22:58.647726Z","iopub.status.idle":"2022-07-31T06:22:58.869056Z","shell.execute_reply.started":"2022-07-31T06:22:58.647691Z","shell.execute_reply":"2022-07-31T06:22:58.867535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def impute_age(cols):\n    Age = cols[0]\n    Pclass = cols[1]\n    \n    if pd.isnull(Age):\n\n        if Pclass == 1:\n            return 37\n\n        elif Pclass == 2:\n            return 29\n\n        else:\n            return 24\n\n    else:\n        return Age","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:24:26.791787Z","iopub.execute_input":"2022-07-31T06:24:26.793170Z","iopub.status.idle":"2022-07-31T06:24:26.801986Z","shell.execute_reply.started":"2022-07-31T06:24:26.793110Z","shell.execute_reply":"2022-07-31T06:24:26.800641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train['Age'] = df_train[['Age','Pclass']].apply(impute_age,axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:28:45.587291Z","iopub.execute_input":"2022-07-31T06:28:45.588573Z","iopub.status.idle":"2022-07-31T06:28:45.607821Z","shell.execute_reply.started":"2022-07-31T06:28:45.588521Z","shell.execute_reply":"2022-07-31T06:28:45.606794Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(df_train.isnull(),yticklabels=False,cbar=False,cmap='viridis')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:28:56.787635Z","iopub.execute_input":"2022-07-31T06:28:56.788080Z","iopub.status.idle":"2022-07-31T06:28:57.009607Z","shell.execute_reply.started":"2022-07-31T06:28:56.788044Z","shell.execute_reply":"2022-07-31T06:28:57.008440Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Drop the Cabin column as large number of data is missing","metadata":{}},{"cell_type":"markdown","source":"Age has been imputed , now there is no missing value","metadata":{}},{"cell_type":"code","source":"df_train.drop('Cabin',axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:32:21.593203Z","iopub.execute_input":"2022-07-31T06:32:21.593715Z","iopub.status.idle":"2022-07-31T06:32:21.602142Z","shell.execute_reply.started":"2022-07-31T06:32:21.593675Z","shell.execute_reply":"2022-07-31T06:32:21.600971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.dropna(inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:33:05.124741Z","iopub.execute_input":"2022-07-31T06:33:05.125178Z","iopub.status.idle":"2022-07-31T06:33:05.134979Z","shell.execute_reply.started":"2022-07-31T06:33:05.125142Z","shell.execute_reply":"2022-07-31T06:33:05.134047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:33:16.829749Z","iopub.execute_input":"2022-07-31T06:33:16.830237Z","iopub.status.idle":"2022-07-31T06:33:16.848483Z","shell.execute_reply.started":"2022-07-31T06:33:16.830200Z","shell.execute_reply":"2022-07-31T06:33:16.847526Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:33:35.531785Z","iopub.execute_input":"2022-07-31T06:33:35.532186Z","iopub.status.idle":"2022-07-31T06:33:35.543417Z","shell.execute_reply.started":"2022-07-31T06:33:35.532153Z","shell.execute_reply":"2022-07-31T06:33:35.542165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"converting categorical features","metadata":{}},{"cell_type":"code","source":"df_train.info()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:39:21.034868Z","iopub.execute_input":"2022-07-31T06:39:21.035837Z","iopub.status.idle":"2022-07-31T06:39:21.052788Z","shell.execute_reply.started":"2022-07-31T06:39:21.035802Z","shell.execute_reply":"2022-07-31T06:39:21.051361Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sex = pd.get_dummies(df_train['Sex'],drop_first=True)\nembark = pd.get_dummies(df_train['Embarked'],drop_first=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:40:22.463529Z","iopub.execute_input":"2022-07-31T06:40:22.463901Z","iopub.status.idle":"2022-07-31T06:40:22.471682Z","shell.execute_reply.started":"2022-07-31T06:40:22.463871Z","shell.execute_reply":"2022-07-31T06:40:22.470528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.drop(['Sex','Embarked','Name','Ticket'],axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:41:22.863373Z","iopub.execute_input":"2022-07-31T06:41:22.864088Z","iopub.status.idle":"2022-07-31T06:41:22.869148Z","shell.execute_reply.started":"2022-07-31T06:41:22.864049Z","shell.execute_reply":"2022-07-31T06:41:22.868401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train = pd.concat([df_train,sex,embark],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:42:26.719793Z","iopub.execute_input":"2022-07-31T06:42:26.720577Z","iopub.status.idle":"2022-07-31T06:42:26.728348Z","shell.execute_reply.started":"2022-07-31T06:42:26.720539Z","shell.execute_reply":"2022-07-31T06:42:26.727530Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:42:35.800414Z","iopub.execute_input":"2022-07-31T06:42:35.801519Z","iopub.status.idle":"2022-07-31T06:42:35.822953Z","shell.execute_reply.started":"2022-07-31T06:42:35.801469Z","shell.execute_reply":"2022-07-31T06:42:35.822071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Building Model using logistic regression","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:43:26.331802Z","iopub.execute_input":"2022-07-31T06:43:26.332425Z","iopub.status.idle":"2022-07-31T06:43:26.337527Z","shell.execute_reply.started":"2022-07-31T06:43:26.332387Z","shell.execute_reply":"2022-07-31T06:43:26.336556Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = df_train.drop('Survived',axis=1)\ny = df_train['Survived']","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:45:03.006152Z","iopub.execute_input":"2022-07-31T06:45:03.006965Z","iopub.status.idle":"2022-07-31T06:45:03.014337Z","shell.execute_reply.started":"2022-07-31T06:45:03.006917Z","shell.execute_reply":"2022-07-31T06:45:03.013527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=101)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:45:23.023963Z","iopub.execute_input":"2022-07-31T06:45:23.024362Z","iopub.status.idle":"2022-07-31T06:45:23.032762Z","shell.execute_reply.started":"2022-07-31T06:45:23.024328Z","shell.execute_reply":"2022-07-31T06:45:23.030999Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:45:59.048530Z","iopub.execute_input":"2022-07-31T06:45:59.049485Z","iopub.status.idle":"2022-07-31T06:45:59.054640Z","shell.execute_reply.started":"2022-07-31T06:45:59.049431Z","shell.execute_reply":"2022-07-31T06:45:59.053496Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = LogisticRegression()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:46:14.162651Z","iopub.execute_input":"2022-07-31T06:46:14.163059Z","iopub.status.idle":"2022-07-31T06:46:14.168216Z","shell.execute_reply.started":"2022-07-31T06:46:14.163025Z","shell.execute_reply":"2022-07-31T06:46:14.167069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.fit(X_train,y_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:46:42.701576Z","iopub.execute_input":"2022-07-31T06:46:42.702270Z","iopub.status.idle":"2022-07-31T06:46:42.738127Z","shell.execute_reply.started":"2022-07-31T06:46:42.702230Z","shell.execute_reply":"2022-07-31T06:46:42.736981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred = model.predict(X_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:49:22.338520Z","iopub.execute_input":"2022-07-31T06:49:22.338928Z","iopub.status.idle":"2022-07-31T06:49:22.347042Z","shell.execute_reply.started":"2022-07-31T06:49:22.338896Z","shell.execute_reply":"2022-07-31T06:49:22.345918Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import classification_report,confusion_matrix","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:50:46.769211Z","iopub.execute_input":"2022-07-31T06:50:46.769742Z","iopub.status.idle":"2022-07-31T06:50:46.778623Z","shell.execute_reply.started":"2022-07-31T06:50:46.769701Z","shell.execute_reply":"2022-07-31T06:50:46.776684Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(classification_report(y_test,pred))","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:50:17.075684Z","iopub.execute_input":"2022-07-31T06:50:17.076296Z","iopub.status.idle":"2022-07-31T06:50:17.086826Z","shell.execute_reply.started":"2022-07-31T06:50:17.076261Z","shell.execute_reply":"2022-07-31T06:50:17.085680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(confusion_matrix(y_test,pred))","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:51:08.861763Z","iopub.execute_input":"2022-07-31T06:51:08.862208Z","iopub.status.idle":"2022-07-31T06:51:08.876407Z","shell.execute_reply.started":"2022-07-31T06:51:08.862172Z","shell.execute_reply":"2022-07-31T06:51:08.874878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pd.read_csv('/kaggle/input/titanic/test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:52:01.461913Z","iopub.execute_input":"2022-07-31T06:52:01.462347Z","iopub.status.idle":"2022-07-31T06:52:01.485615Z","shell.execute_reply.started":"2022-07-31T06:52:01.462303Z","shell.execute_reply":"2022-07-31T06:52:01.484158Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:52:16.210212Z","iopub.execute_input":"2022-07-31T06:52:16.211354Z","iopub.status.idle":"2022-07-31T06:52:16.228919Z","shell.execute_reply.started":"2022-07-31T06:52:16.211302Z","shell.execute_reply":"2022-07-31T06:52:16.228069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:55:08.306206Z","iopub.execute_input":"2022-07-31T06:55:08.306710Z","iopub.status.idle":"2022-07-31T06:55:08.319049Z","shell.execute_reply.started":"2022-07-31T06:55:08.306668Z","shell.execute_reply":"2022-07-31T06:55:08.317522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test['Age'] = df_test[['Age','Pclass']].apply(impute_age,axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:57:53.871311Z","iopub.execute_input":"2022-07-31T06:57:53.871867Z","iopub.status.idle":"2022-07-31T06:57:53.887869Z","shell.execute_reply.started":"2022-07-31T06:57:53.871826Z","shell.execute_reply":"2022-07-31T06:57:53.886709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.drop('Cabin',axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:59:09.115553Z","iopub.execute_input":"2022-07-31T06:59:09.116234Z","iopub.status.idle":"2022-07-31T06:59:09.123571Z","shell.execute_reply.started":"2022-07-31T06:59:09.116196Z","shell.execute_reply":"2022-07-31T06:59:09.122210Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sex_test = pd.get_dummies(df_test['Sex'],drop_first=True)\nembark_test = pd.get_dummies(df_test['Embarked'],drop_first=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T06:59:48.593272Z","iopub.execute_input":"2022-07-31T06:59:48.594156Z","iopub.status.idle":"2022-07-31T06:59:48.604191Z","shell.execute_reply.started":"2022-07-31T06:59:48.594108Z","shell.execute_reply":"2022-07-31T06:59:48.603026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.drop(['Sex','Embarked','Name','Ticket'],axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T07:00:24.995541Z","iopub.execute_input":"2022-07-31T07:00:24.996421Z","iopub.status.idle":"2022-07-31T07:00:25.005163Z","shell.execute_reply.started":"2022-07-31T07:00:24.996371Z","shell.execute_reply":"2022-07-31T07:00:25.003480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pd.concat([df_test,sex_test,embark_test],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T07:01:18.722841Z","iopub.execute_input":"2022-07-31T07:01:18.723248Z","iopub.status.idle":"2022-07-31T07:01:18.729641Z","shell.execute_reply.started":"2022-07-31T07:01:18.723208Z","shell.execute_reply":"2022-07-31T07:01:18.728623Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.dropna(inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T07:02:38.298408Z","iopub.execute_input":"2022-07-31T07:02:38.299213Z","iopub.status.idle":"2022-07-31T07:02:38.308725Z","shell.execute_reply.started":"2022-07-31T07:02:38.299167Z","shell.execute_reply":"2022-07-31T07:02:38.307115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.predict(df_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-31T07:04:41.077421Z","iopub.execute_input":"2022-07-31T07:04:41.078159Z","iopub.status.idle":"2022-07-31T07:04:41.088356Z","shell.execute_reply.started":"2022-07-31T07:04:41.078115Z","shell.execute_reply":"2022-07-31T07:04:41.087315Z"},"trusted":true},"execution_count":null,"outputs":[]}]}