{"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":"markdown","source":"<b> Import Dependencies and Dataset </b> ","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport seaborn as sb\nimport numpy as np\nfrom sklearn.preprocessing import OneHotEncoder\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import confusion_matrix\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:25.999180Z","iopub.execute_input":"2022-07-21T04:05:26.000121Z","iopub.status.idle":"2022-07-21T04:05:26.637989Z","shell.execute_reply.started":"2022-07-21T04:05:26.000040Z","shell.execute_reply":"2022-07-21T04:05:26.636951Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=pd.read_csv(\"../input/titanic/train.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.639531Z","iopub.execute_input":"2022-07-21T04:05:26.640237Z","iopub.status.idle":"2022-07-21T04:05:26.652967Z","shell.execute_reply.started":"2022-07-21T04:05:26.640191Z","shell.execute_reply":"2022-07-21T04:05:26.651804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head(50)","metadata":{"scrolled":true,"execution":{"iopub.status.busy":"2022-07-21T04:05:26.654336Z","iopub.execute_input":"2022-07-21T04:05:26.654690Z","iopub.status.idle":"2022-07-21T04:05:26.698533Z","shell.execute_reply.started":"2022-07-21T04:05:26.654656Z","shell.execute_reply":"2022-07-21T04:05:26.697637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<b> EDA </b> ","metadata":{}},{"cell_type":"code","source":"data.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.701487Z","iopub.execute_input":"2022-07-21T04:05:26.701820Z","iopub.status.idle":"2022-07-21T04:05:26.710394Z","shell.execute_reply.started":"2022-07-21T04:05:26.701790Z","shell.execute_reply":"2022-07-21T04:05:26.709219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"PassengerId\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.711928Z","iopub.execute_input":"2022-07-21T04:05:26.713102Z","iopub.status.idle":"2022-07-21T04:05:26.726796Z","shell.execute_reply.started":"2022-07-21T04:05:26.713046Z","shell.execute_reply":"2022-07-21T04:05:26.725866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.728188Z","iopub.execute_input":"2022-07-21T04:05:26.729145Z","iopub.status.idle":"2022-07-21T04:05:26.739186Z","shell.execute_reply.started":"2022-07-21T04:05:26.729086Z","shell.execute_reply":"2022-07-21T04:05:26.738169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.catplot( y=\"Sex\", data =data, kind = \"count\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.740758Z","iopub.execute_input":"2022-07-21T04:05:26.741780Z","iopub.status.idle":"2022-07-21T04:05:26.993789Z","shell.execute_reply.started":"2022-07-21T04:05:26.741747Z","shell.execute_reply":"2022-07-21T04:05:26.992571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.catplot( y=\"Survived\", data =data, kind = \"count\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:26.995302Z","iopub.execute_input":"2022-07-21T04:05:26.995678Z","iopub.status.idle":"2022-07-21T04:05:27.220010Z","shell.execute_reply.started":"2022-07-21T04:05:26.995638Z","shell.execute_reply":"2022-07-21T04:05:27.219116Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.catplot( y=\"Embarked\", data =data, kind = \"count\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:27.221436Z","iopub.execute_input":"2022-07-21T04:05:27.222002Z","iopub.status.idle":"2022-07-21T04:05:27.459565Z","shell.execute_reply.started":"2022-07-21T04:05:27.221965Z","shell.execute_reply":"2022-07-21T04:05:27.458781Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.catplot( y=\"Pclass\", data =data, kind = \"count\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:27.460956Z","iopub.execute_input":"2022-07-21T04:05:27.461516Z","iopub.status.idle":"2022-07-21T04:05:27.690184Z","shell.execute_reply.started":"2022-07-21T04:05:27.461482Z","shell.execute_reply":"2022-07-21T04:05:27.689042Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nf,axes=plt.subplots(4,3,figsize=(18,24))\ncount=0\nx=[\"Age\",\"Fare\",\"Parch\",\"SibSp\"]\nfor var in x:\n    sb.boxplot(data=data,x=var,orient='h',ax=axes[count,0])\n    sb.histplot(data=data, x=var,kde=True,ax=axes[count,1])\n    sb.violinplot(data=data,x=var,orient='h',ax=axes[count,2])\n    count+=1","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:27.691736Z","iopub.execute_input":"2022-07-21T04:05:27.692320Z","iopub.status.idle":"2022-07-21T04:05:29.509090Z","shell.execute_reply.started":"2022-07-21T04:05:27.692286Z","shell.execute_reply":"2022-07-21T04:05:29.507709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.boxplot(x=\"Survived\",y=\"Age\",data=data)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:29.510788Z","iopub.execute_input":"2022-07-21T04:05:29.511541Z","iopub.status.idle":"2022-07-21T04:05:29.716616Z","shell.execute_reply.started":"2022-07-21T04:05:29.511493Z","shell.execute_reply":"2022-07-21T04:05:29.715421Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.boxplot(x=\"Survived\",y=\"Fare\",data=data)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:29.721716Z","iopub.execute_input":"2022-07-21T04:05:29.722065Z","iopub.status.idle":"2022-07-21T04:05:29.896347Z","shell.execute_reply.started":"2022-07-21T04:05:29.722035Z","shell.execute_reply":"2022-07-21T04:05:29.895129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.boxplot(x=\"Survived\",y=\"Parch\",data=data)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:29.897571Z","iopub.execute_input":"2022-07-21T04:05:29.897905Z","iopub.status.idle":"2022-07-21T04:05:30.076771Z","shell.execute_reply.started":"2022-07-21T04:05:29.897875Z","shell.execute_reply":"2022-07-21T04:05:30.075642Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.boxplot(x=\"Survived\",y=\"SibSp\",data=data)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.078033Z","iopub.execute_input":"2022-07-21T04:05:30.078359Z","iopub.status.idle":"2022-07-21T04:05:30.266032Z","shell.execute_reply.started":"2022-07-21T04:05:30.078331Z","shell.execute_reply":"2022-07-21T04:05:30.265280Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"Age\"].fillna(data.Age.mean(),inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.267251Z","iopub.execute_input":"2022-07-21T04:05:30.267820Z","iopub.status.idle":"2022-07-21T04:05:30.273538Z","shell.execute_reply.started":"2022-07-21T04:05:30.267788Z","shell.execute_reply":"2022-07-21T04:05:30.272789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.274969Z","iopub.execute_input":"2022-07-21T04:05:30.275566Z","iopub.status.idle":"2022-07-21T04:05:30.289923Z","shell.execute_reply.started":"2022-07-21T04:05:30.275518Z","shell.execute_reply":"2022-07-21T04:05:30.288655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"Embarked\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.291601Z","iopub.execute_input":"2022-07-21T04:05:30.292281Z","iopub.status.idle":"2022-07-21T04:05:30.300735Z","shell.execute_reply.started":"2022-07-21T04:05:30.292244Z","shell.execute_reply":"2022-07-21T04:05:30.299809Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"Embarked\"].fillna(\"S\",inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.302153Z","iopub.execute_input":"2022-07-21T04:05:30.303118Z","iopub.status.idle":"2022-07-21T04:05:30.308871Z","shell.execute_reply.started":"2022-07-21T04:05:30.303081Z","shell.execute_reply":"2022-07-21T04:05:30.307890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.310148Z","iopub.execute_input":"2022-07-21T04:05:30.310914Z","iopub.status.idle":"2022-07-21T04:05:30.324899Z","shell.execute_reply.started":"2022-07-21T04:05:30.310880Z","shell.execute_reply":"2022-07-21T04:05:30.323739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"var=[\"Pclass\",\"Sex\",\"Age\",\"SibSp\",\"Parch\",\"Fare\",\"Embarked\",\"Survived\"]\ncatvar=[\"Sex\",\"Embarked\"]\ndf=data[var]","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.326380Z","iopub.execute_input":"2022-07-21T04:05:30.327226Z","iopub.status.idle":"2022-07-21T04:05:30.333011Z","shell.execute_reply.started":"2022-07-21T04:05:30.327192Z","shell.execute_reply":"2022-07-21T04:05:30.332143Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Manual One Hot Encoding using get_dummies()**","metadata":{}},{"cell_type":"code","source":"df=pd.get_dummies(df, columns=catvar)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.334272Z","iopub.execute_input":"2022-07-21T04:05:30.335108Z","iopub.status.idle":"2022-07-21T04:05:30.348912Z","shell.execute_reply.started":"2022-07-21T04:05:30.335074Z","shell.execute_reply":"2022-07-21T04:05:30.347813Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.350198Z","iopub.execute_input":"2022-07-21T04:05:30.350852Z","iopub.status.idle":"2022-07-21T04:05:30.370365Z","shell.execute_reply.started":"2022-07-21T04:05:30.350819Z","shell.execute_reply":"2022-07-21T04:05:30.369580Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x=df.drop(columns=\"Survived\")\ny=df[[\"Survived\"]]","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.372102Z","iopub.execute_input":"2022-07-21T04:05:30.372887Z","iopub.status.idle":"2022-07-21T04:05:30.381288Z","shell.execute_reply.started":"2022-07-21T04:05:30.372841Z","shell.execute_reply":"2022-07-21T04:05:30.380095Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.382904Z","iopub.execute_input":"2022-07-21T04:05:30.383306Z","iopub.status.idle":"2022-07-21T04:05:30.404860Z","shell.execute_reply.started":"2022-07-21T04:05:30.383213Z","shell.execute_reply":"2022-07-21T04:05:30.403678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.406306Z","iopub.execute_input":"2022-07-21T04:05:30.407487Z","iopub.status.idle":"2022-07-21T04:05:30.418296Z","shell.execute_reply.started":"2022-07-21T04:05:30.407441Z","shell.execute_reply":"2022-07-21T04:05:30.417559Z"},"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.2,random_state=32)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.419255Z","iopub.execute_input":"2022-07-21T04:05:30.419951Z","iopub.status.idle":"2022-07-21T04:05:30.432012Z","shell.execute_reply.started":"2022-07-21T04:05:30.419921Z","shell.execute_reply":"2022-07-21T04:05:30.430797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sb.catplot( y=\"Survived\", data =y_train, kind = \"count\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.434213Z","iopub.execute_input":"2022-07-21T04:05:30.434703Z","iopub.status.idle":"2022-07-21T04:05:30.658203Z","shell.execute_reply.started":"2022-07-21T04:05:30.434658Z","shell.execute_reply":"2022-07-21T04:05:30.657116Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train[\"Survived\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.660000Z","iopub.execute_input":"2022-07-21T04:05:30.660305Z","iopub.status.idle":"2022-07-21T04:05:30.668502Z","shell.execute_reply.started":"2022-07-21T04:05:30.660278Z","shell.execute_reply":"2022-07-21T04:05:30.667388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Hyperparameter Tuning **","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import RandomizedSearchCV\n\nn_estimators = [int(x) for x in np.linspace(start = 200, stop = 2000, num = 10)]\nmax_features = ['auto', 'sqrt','log2']\nmax_depth = [int(x) for x in np.linspace(10, 110, num = 11)]\nmax_depth.append(None)\nmin_samples_split = [2, 5, 10]\nmin_samples_leaf = [1, 2, 4]\nbootstrap = [True, False]\n# Create the random grid\nrandom_grid = {'n_estimators': n_estimators,\n               'max_features': max_features,\n               'max_depth': max_depth,\n               'min_samples_split': min_samples_split,\n               'min_samples_leaf': min_samples_leaf,\n               'bootstrap': bootstrap}\n\nrf=RandomForestClassifier()\nrf_random=RandomizedSearchCV(estimator=rf,param_distributions=random_grid,random_state=42,n_jobs=-1,n_iter=50)\nrf_random.fit(x_train,y_train)\nrf_random.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:05:30.670206Z","iopub.execute_input":"2022-07-21T04:05:30.670865Z","iopub.status.idle":"2022-07-21T04:08:55.713851Z","shell.execute_reply.started":"2022-07-21T04:05:30.670820Z","shell.execute_reply":"2022-07-21T04:08:55.712536Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf = RandomForestClassifier(n_estimators = 1200, min_samples_split=10,min_samples_leaf=2,max_features='log2',bootstrap=False,max_depth = 50,random_state=42)\nrf.fit(x_train, y_train)\nprint(\"Classification Accuracy \\t:\", rf.score(x_train, y_train))","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:05.803191Z","iopub.execute_input":"2022-07-21T04:10:05.803691Z","iopub.status.idle":"2022-07-21T04:10:08.060971Z","shell.execute_reply.started":"2022-07-21T04:10:05.803643Z","shell.execute_reply":"2022-07-21T04:10:08.059727Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=pd.read_csv(\"../input/titanic/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.035895Z","iopub.execute_input":"2022-07-21T04:10:29.036581Z","iopub.status.idle":"2022-07-21T04:10:29.047470Z","shell.execute_reply.started":"2022-07-21T04:10:29.036531Z","shell.execute_reply":"2022-07-21T04:10:29.046213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.070576Z","iopub.execute_input":"2022-07-21T04:10:29.071663Z","iopub.status.idle":"2022-07-21T04:10:29.090101Z","shell.execute_reply.started":"2022-07-21T04:10:29.071577Z","shell.execute_reply":"2022-07-21T04:10:29.088695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.092176Z","iopub.execute_input":"2022-07-21T04:10:29.092570Z","iopub.status.idle":"2022-07-21T04:10:29.105707Z","shell.execute_reply.started":"2022-07-21T04:10:29.092525Z","shell.execute_reply":"2022-07-21T04:10:29.104466Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"PassengerId\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.107722Z","iopub.execute_input":"2022-07-21T04:10:29.108823Z","iopub.status.idle":"2022-07-21T04:10:29.120242Z","shell.execute_reply.started":"2022-07-21T04:10:29.108777Z","shell.execute_reply":"2022-07-21T04:10:29.118939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.126204Z","iopub.execute_input":"2022-07-21T04:10:29.127267Z","iopub.status.idle":"2022-07-21T04:10:29.138337Z","shell.execute_reply.started":"2022-07-21T04:10:29.127231Z","shell.execute_reply":"2022-07-21T04:10:29.136840Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"Age\"].fillna(data.Age.mean(),inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.140163Z","iopub.execute_input":"2022-07-21T04:10:29.140498Z","iopub.status.idle":"2022-07-21T04:10:29.146422Z","shell.execute_reply.started":"2022-07-21T04:10:29.140468Z","shell.execute_reply":"2022-07-21T04:10:29.145303Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"Fare\"].fillna(data.Age.mean(),inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.156240Z","iopub.execute_input":"2022-07-21T04:10:29.157019Z","iopub.status.idle":"2022-07-21T04:10:29.163242Z","shell.execute_reply.started":"2022-07-21T04:10:29.156972Z","shell.execute_reply":"2022-07-21T04:10:29.161833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.171692Z","iopub.execute_input":"2022-07-21T04:10:29.172634Z","iopub.status.idle":"2022-07-21T04:10:29.181818Z","shell.execute_reply.started":"2022-07-21T04:10:29.172556Z","shell.execute_reply":"2022-07-21T04:10:29.180766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"var=[\"Pclass\",\"Sex\",\"Age\",\"SibSp\",\"Parch\",\"Fare\",\"Embarked\"]\ncatvar=[\"Sex\",\"Embarked\"]\ndf=data[var]","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.187086Z","iopub.execute_input":"2022-07-21T04:10:29.188073Z","iopub.status.idle":"2022-07-21T04:10:29.195719Z","shell.execute_reply.started":"2022-07-21T04:10:29.188025Z","shell.execute_reply":"2022-07-21T04:10:29.194652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.get_dummies(df, columns=catvar)\ndf","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.206340Z","iopub.execute_input":"2022-07-21T04:10:29.207346Z","iopub.status.idle":"2022-07-21T04:10:29.231912Z","shell.execute_reply.started":"2022-07-21T04:10:29.207307Z","shell.execute_reply":"2022-07-21T04:10:29.231052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Survived=rf.predict(df)","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.233891Z","iopub.execute_input":"2022-07-21T04:10:29.234942Z","iopub.status.idle":"2022-07-21T04:10:29.486549Z","shell.execute_reply.started":"2022-07-21T04:10:29.234906Z","shell.execute_reply":"2022-07-21T04:10:29.485274Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_final=pd.read_csv('../input/titanic/test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.488612Z","iopub.execute_input":"2022-07-21T04:10:29.488979Z","iopub.status.idle":"2022-07-21T04:10:29.498812Z","shell.execute_reply.started":"2022-07-21T04:10:29.488948Z","shell.execute_reply":"2022-07-21T04:10:29.497471Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_final=df_final[[\"PassengerId\"]]\ndf_final[\"Survived\"]=Survived","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.500838Z","iopub.execute_input":"2022-07-21T04:10:29.501867Z","iopub.status.idle":"2022-07-21T04:10:29.508903Z","shell.execute_reply.started":"2022-07-21T04:10:29.501834Z","shell.execute_reply":"2022-07-21T04:10:29.507963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_final","metadata":{"execution":{"iopub.status.busy":"2022-07-21T04:10:29.511160Z","iopub.execute_input":"2022-07-21T04:10:29.512002Z","iopub.status.idle":"2022-07-21T04:10:29.528880Z","shell.execute_reply.started":"2022-07-21T04:10:29.511956Z","shell.execute_reply":"2022-07-21T04:10:29.527914Z"},"trusted":true},"execution_count":null,"outputs":[]}]}