{"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":"Neste notebook usei o conjunto de dados da competição Titanic para treinar árvore de decisão.\n","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\nfrom sklearn import tree\nfrom sklearn.tree import DecisionTreeClassifier\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.datasets import make_classification\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.metrics import plot_confusion_matrix\nfrom sklearn.model_selection import train_test_split\n\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.641407Z","iopub.execute_input":"2022-07-11T03:26:47.641789Z","iopub.status.idle":"2022-07-11T03:26:47.652718Z","shell.execute_reply.started":"2022-07-11T03:26:47.641758Z","shell.execute_reply":"2022-07-11T03:26:47.651509Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Exploração dos dados\nManipulação e limpeza dos dados","metadata":{}},{"cell_type":"code","source":"arquivo_train=pd.read_csv('/kaggle/input/titanic/train.csv')\narquivo_test=pd.read_csv('/kaggle/input/titanic/test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.659699Z","iopub.execute_input":"2022-07-11T03:26:47.660198Z","iopub.status.idle":"2022-07-11T03:26:47.683361Z","shell.execute_reply.started":"2022-07-11T03:26:47.660142Z","shell.execute_reply":"2022-07-11T03:26:47.681932Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"arquivo_train.info(),arquivo_test.info()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.686765Z","iopub.execute_input":"2022-07-11T03:26:47.687301Z","iopub.status.idle":"2022-07-11T03:26:47.716780Z","shell.execute_reply.started":"2022-07-11T03:26:47.687238Z","shell.execute_reply":"2022-07-11T03:26:47.715313Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df=pd.DataFrame(arquivo_train)\ntest_df=pd.DataFrame(arquivo_test)\ntrain_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.718543Z","iopub.execute_input":"2022-07-11T03:26:47.720346Z","iopub.status.idle":"2022-07-11T03:26:47.743560Z","shell.execute_reply.started":"2022-07-11T03:26:47.720296Z","shell.execute_reply":"2022-07-11T03:26:47.742343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"1. Manipulação e limpeza dos dados","metadata":{}},{"cell_type":"code","source":"train_df['Sex']=train_df['Sex'].replace('female',0).replace('male',1)\ntest_df['Sex']=test_df['Sex'].replace('female',0).replace('male',1)\n#Todos os passageiros do gênero feminino está repesentado por número 0 e masculino 1","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.745564Z","iopub.execute_input":"2022-07-11T03:26:47.746342Z","iopub.status.idle":"2022-07-11T03:26:47.760157Z","shell.execute_reply.started":"2022-07-11T03:26:47.746294Z","shell.execute_reply":"2022-07-11T03:26:47.759101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dummies_train=pd.get_dummies(train_df['Embarked'])\ndummies_test=pd.get_dummies(test_df['Embarked'])\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.764441Z","iopub.execute_input":"2022-07-11T03:26:47.764847Z","iopub.status.idle":"2022-07-11T03:26:47.775327Z","shell.execute_reply.started":"2022-07-11T03:26:47.764807Z","shell.execute_reply":"2022-07-11T03:26:47.773651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dummies_train=pd.DataFrame(dummies_train)\ndummies_test=pd.DataFrame(dummies_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.777366Z","iopub.execute_input":"2022-07-11T03:26:47.778234Z","iopub.status.idle":"2022-07-11T03:26:47.783920Z","shell.execute_reply.started":"2022-07-11T03:26:47.778183Z","shell.execute_reply":"2022-07-11T03:26:47.782739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df1=pd.concat([train_df,dummies_train],axis=1)\ntest_df1=pd.concat([test_df,dummies_test],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.785883Z","iopub.execute_input":"2022-07-11T03:26:47.786624Z","iopub.status.idle":"2022-07-11T03:26:47.800484Z","shell.execute_reply.started":"2022-07-11T03:26:47.786580Z","shell.execute_reply":"2022-07-11T03:26:47.799085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df1.head(10)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.801970Z","iopub.execute_input":"2022-07-11T03:26:47.803201Z","iopub.status.idle":"2022-07-11T03:26:47.827134Z","shell.execute_reply.started":"2022-07-11T03:26:47.803152Z","shell.execute_reply":"2022-07-11T03:26:47.825937Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df1.head(10)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.828614Z","iopub.execute_input":"2022-07-11T03:26:47.829066Z","iopub.status.idle":"2022-07-11T03:26:47.856463Z","shell.execute_reply.started":"2022-07-11T03:26:47.829023Z","shell.execute_reply":"2022-07-11T03:26:47.855252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df1.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.858126Z","iopub.execute_input":"2022-07-11T03:26:47.859223Z","iopub.status.idle":"2022-07-11T03:26:47.874962Z","shell.execute_reply.started":"2022-07-11T03:26:47.859174Z","shell.execute_reply":"2022-07-11T03:26:47.873507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df2=train_df1.drop(['Cabin','Age','Name','Ticket','Embarked'],axis=1)\ntest_df2=test_df1.drop(['Cabin','Age','Name','Ticket','Embarked'],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.877786Z","iopub.execute_input":"2022-07-11T03:26:47.878658Z","iopub.status.idle":"2022-07-11T03:26:47.891408Z","shell.execute_reply.started":"2022-07-11T03:26:47.878607Z","shell.execute_reply":"2022-07-11T03:26:47.889855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df2.fillna(0,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.895041Z","iopub.execute_input":"2022-07-11T03:26:47.896483Z","iopub.status.idle":"2022-07-11T03:26:47.902634Z","shell.execute_reply.started":"2022-07-11T03:26:47.896434Z","shell.execute_reply":"2022-07-11T03:26:47.901660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=train_df2.Survived\nx=train_df2.drop('Survived',axis=1)\n\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.904968Z","iopub.execute_input":"2022-07-11T03:26:47.908516Z","iopub.status.idle":"2022-07-11T03:26:47.922634Z","shell.execute_reply.started":"2022-07-11T03:26:47.908463Z","shell.execute_reply":"2022-07-11T03:26:47.921199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf = DecisionTreeClassifier(random_state=42)\nclf","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.933703Z","iopub.execute_input":"2022-07-11T03:26:47.935054Z","iopub.status.idle":"2022-07-11T03:26:47.943883Z","shell.execute_reply.started":"2022-07-11T03:26:47.934979Z","shell.execute_reply":"2022-07-11T03:26:47.942561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df2.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.946067Z","iopub.execute_input":"2022-07-11T03:26:47.946891Z","iopub.status.idle":"2022-07-11T03:26:47.959286Z","shell.execute_reply.started":"2022-07-11T03:26:47.946842Z","shell.execute_reply":"2022-07-11T03:26:47.958085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.961278Z","iopub.execute_input":"2022-07-11T03:26:47.962148Z","iopub.status.idle":"2022-07-11T03:26:47.992247Z","shell.execute_reply.started":"2022-07-11T03:26:47.962096Z","shell.execute_reply":"2022-07-11T03:26:47.991151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf=clf.fit(x[['Sex']],y)\nclf","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:47.993699Z","iopub.execute_input":"2022-07-11T03:26:47.994883Z","iopub.status.idle":"2022-07-11T03:26:48.011497Z","shell.execute_reply.started":"2022-07-11T03:26:47.994833Z","shell.execute_reply":"2022-07-11T03:26:48.010268Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df2.Sex.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:48.013140Z","iopub.execute_input":"2022-07-11T03:26:48.014452Z","iopub.status.idle":"2022-07-11T03:26:48.024107Z","shell.execute_reply.started":"2022-07-11T03:26:48.014403Z","shell.execute_reply":"2022-07-11T03:26:48.022979Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(25,10))\ntree.plot_tree(clf,\n         filled=True,\n         class_names= ['Died','Survived'],\n         feature_names=['Sex']);\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:48.025871Z","iopub.execute_input":"2022-07-11T03:26:48.026581Z","iopub.status.idle":"2022-07-11T03:26:48.349551Z","shell.execute_reply.started":"2022-07-11T03:26:48.026533Z","shell.execute_reply":"2022-07-11T03:26:48.348617Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf=clf.fit(x,y)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:48.350815Z","iopub.execute_input":"2022-07-11T03:26:48.351363Z","iopub.status.idle":"2022-07-11T03:26:48.361412Z","shell.execute_reply.started":"2022-07-11T03:26:48.351321Z","shell.execute_reply":"2022-07-11T03:26:48.360254Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(25,10))\ntree.plot_tree(clf,\n         filled=True,\n         class_names= ['Died','Survived'],\n         feature_names=x.columns);","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:26:48.362887Z","iopub.execute_input":"2022-07-11T03:26:48.363638Z","iopub.status.idle":"2022-07-11T03:27:09.018387Z","shell.execute_reply.started":"2022-07-11T03:26:48.363592Z","shell.execute_reply":"2022-07-11T03:27:09.017083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_confusion_matrix(clf,x,y,display_labels=['Died','Survived'])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.020061Z","iopub.execute_input":"2022-07-11T03:27:09.020588Z","iopub.status.idle":"2022-07-11T03:27:09.235458Z","shell.execute_reply.started":"2022-07-11T03:27:09.020544Z","shell.execute_reply":"2022-07-11T03:27:09.234272Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict=clf.predict(x)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.238075Z","iopub.execute_input":"2022-07-11T03:27:09.238619Z","iopub.status.idle":"2022-07-11T03:27:09.245293Z","shell.execute_reply.started":"2022-07-11T03:27:09.238577Z","shell.execute_reply":"2022-07-11T03:27:09.244172Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"accuracy_score(y,predict)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.247039Z","iopub.execute_input":"2022-07-11T03:27:09.247721Z","iopub.status.idle":"2022-07-11T03:27:09.258500Z","shell.execute_reply.started":"2022-07-11T03:27:09.247677Z","shell.execute_reply":"2022-07-11T03:27:09.257548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train,x_test,y_train,y_test= train_test_split(x,y,train_size=0.75,random_state=42)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.259846Z","iopub.execute_input":"2022-07-11T03:27:09.260256Z","iopub.status.idle":"2022-07-11T03:27:09.269300Z","shell.execute_reply.started":"2022-07-11T03:27:09.260223Z","shell.execute_reply":"2022-07-11T03:27:09.268343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_test.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.271104Z","iopub.execute_input":"2022-07-11T03:27:09.271863Z","iopub.status.idle":"2022-07-11T03:27:09.283619Z","shell.execute_reply.started":"2022-07-11T03:27:09.271818Z","shell.execute_reply":"2022-07-11T03:27:09.282615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf = DecisionTreeClassifier(random_state=42)\nclf=clf.fit(x_train,y_train)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.284848Z","iopub.execute_input":"2022-07-11T03:27:09.285650Z","iopub.status.idle":"2022-07-11T03:27:09.296844Z","shell.execute_reply.started":"2022-07-11T03:27:09.285612Z","shell.execute_reply":"2022-07-11T03:27:09.295817Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict=clf.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.298501Z","iopub.execute_input":"2022-07-11T03:27:09.298983Z","iopub.status.idle":"2022-07-11T03:27:09.309737Z","shell.execute_reply.started":"2022-07-11T03:27:09.298931Z","shell.execute_reply":"2022-07-11T03:27:09.308860Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_confusion_matrix(clf,x_test,y_test,display_labels=['Died','Survived'])","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.310890Z","iopub.execute_input":"2022-07-11T03:27:09.311507Z","iopub.status.idle":"2022-07-11T03:27:09.495151Z","shell.execute_reply.started":"2022-07-11T03:27:09.311471Z","shell.execute_reply":"2022-07-11T03:27:09.493792Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"accuracy_score(y_test,predict)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.497020Z","iopub.execute_input":"2022-07-11T03:27:09.497604Z","iopub.status.idle":"2022-07-11T03:27:09.506912Z","shell.execute_reply.started":"2022-07-11T03:27:09.497553Z","shell.execute_reply":"2022-07-11T03:27:09.505595Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf = DecisionTreeClassifier(random_state=0)\npath = clf.cost_complexity_pruning_path(x_train, y_train)\nccp_alphas, impurities = path.ccp_alphas, path.impurities\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.508443Z","iopub.execute_input":"2022-07-11T03:27:09.509068Z","iopub.status.idle":"2022-07-11T03:27:09.522037Z","shell.execute_reply.started":"2022-07-11T03:27:09.509029Z","shell.execute_reply":"2022-07-11T03:27:09.520952Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clfs = []\nfor ccp_alpha in ccp_alphas:\n    clf = DecisionTreeClassifier(random_state=0, ccp_alpha=ccp_alpha)\n    clf.fit(x_train, y_train)\n    clfs.append(clf)\nprint(\n    \"Number of nodes in the last tree is: {} with ccp_alpha: {}\".format(\n        clfs[-1].tree_.node_count, ccp_alphas[-1]\n    )\n)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.523495Z","iopub.execute_input":"2022-07-11T03:27:09.524124Z","iopub.status.idle":"2022-07-11T03:27:09.737302Z","shell.execute_reply.started":"2022-07-11T03:27:09.524087Z","shell.execute_reply":"2022-07-11T03:27:09.736077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clfs = clfs[:-1]\nccp_alphas = ccp_alphas[:-1]\n\nnode_counts = [clf.tree_.node_count for clf in clfs]\ndepth = [clf.tree_.max_depth for clf in clfs]\nfig, ax = plt.subplots(2, 1)\nax[0].plot(ccp_alphas, node_counts, marker=\"o\", drawstyle=\"steps-post\")\nax[0].set_xlabel(\"alpha\")\nax[0].set_ylabel(\"number of nodes\")\nax[0].set_title(\"Number of nodes vs alpha\")\nax[1].plot(ccp_alphas, depth, marker=\"o\", drawstyle=\"steps-post\")\nax[1].set_xlabel(\"alpha\")\nax[1].set_ylabel(\"depth of tree\")\nax[1].set_title(\"Depth vs alpha\")\nfig.tight_layout()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:09.738909Z","iopub.execute_input":"2022-07-11T03:27:09.739674Z","iopub.status.idle":"2022-07-11T03:27:10.018447Z","shell.execute_reply.started":"2022-07-11T03:27:09.739629Z","shell.execute_reply":"2022-07-11T03:27:10.017074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_scores = [clf.score(x_train, y_train) for clf in clfs]\ntest_scores = [clf.score(x_test, y_test) for clf in clfs]\n\nfig, ax = plt.subplots()\nax.set_xlabel(\"alpha\")\nax.set_ylabel(\"accuracy\")\nax.set_title(\"Accuracy vs alpha for training and testing sets\")\nax.plot(ccp_alphas, train_scores, marker=\"o\", label=\"train\", drawstyle=\"steps-post\")\nax.plot(ccp_alphas, test_scores, marker=\"o\", label=\"test\", drawstyle=\"steps-post\")\nax.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:10.020086Z","iopub.execute_input":"2022-07-11T03:27:10.020537Z","iopub.status.idle":"2022-07-11T03:27:10.365834Z","shell.execute_reply.started":"2022-07-11T03:27:10.020492Z","shell.execute_reply":"2022-07-11T03:27:10.364738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"alphas=pd.DataFrame(ccp_alphas.tolist())\nscore=pd.DataFrame(test_scores)\nalpha_df=pd.concat([alphas,score],axis=1)\nccp_alpha=0.002232","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:10.368374Z","iopub.execute_input":"2022-07-11T03:27:10.368708Z","iopub.status.idle":"2022-07-11T03:27:10.374852Z","shell.execute_reply.started":"2022-07-11T03:27:10.368677Z","shell.execute_reply":"2022-07-11T03:27:10.373995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf_podada = DecisionTreeClassifier(random_state=42,ccp_alpha=0.002232)\nclf_podada=clf_podada.fit(x_train,y_train)\nplot_confusion_matrix(clf_podada,x_test,y_test,display_labels=['Died','Survived'])","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:10.376543Z","iopub.execute_input":"2022-07-11T03:27:10.376891Z","iopub.status.idle":"2022-07-11T03:27:10.553091Z","shell.execute_reply.started":"2022-07-11T03:27:10.376859Z","shell.execute_reply":"2022-07-11T03:27:10.552089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_chapeu=clf_podada.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:10.554869Z","iopub.execute_input":"2022-07-11T03:27:10.555654Z","iopub.status.idle":"2022-07-11T03:27:10.564604Z","shell.execute_reply.started":"2022-07-11T03:27:10.555604Z","shell.execute_reply":"2022-07-11T03:27:10.563323Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"accuracy_score(y_test,y_chapeu)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:27:10.566392Z","iopub.execute_input":"2022-07-11T03:27:10.567286Z","iopub.status.idle":"2022-07-11T03:27:10.580249Z","shell.execute_reply.started":"2022-07-11T03:27:10.567233Z","shell.execute_reply":"2022-07-11T03:27:10.579277Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"finalizar=pd.DataFrame(test_df['PassengerId'])\nfinal=clf_podada.predict(test_df2)\nfinal1=pd.DataFrame(final,columns=['Survived'])\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:38:43.612791Z","iopub.execute_input":"2022-07-11T03:38:43.613224Z","iopub.status.idle":"2022-07-11T03:38:43.624126Z","shell.execute_reply.started":"2022-07-11T03:38:43.613189Z","shell.execute_reply":"2022-07-11T03:38:43.622995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub=pd.concat([finalizar,final1],axis=1)\nsub.to_csv('submission.csv',index=False)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-11T03:38:57.043736Z","iopub.execute_input":"2022-07-11T03:38:57.044143Z","iopub.status.idle":"2022-07-11T03:38:57.052621Z","shell.execute_reply.started":"2022-07-11T03:38:57.044112Z","shell.execute_reply":"2022-07-11T03:38:57.051682Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}