{"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-26T09:10:20.021799Z","iopub.execute_input":"2022-07-26T09:10:20.023135Z","iopub.status.idle":"2022-07-26T09:10:20.051310Z","shell.execute_reply.started":"2022-07-26T09:10:20.023022Z","shell.execute_reply":"2022-07-26T09:10:20.050292Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\ndata_path = '../input/cat-in-the-dat-ii/'\ntrain = pd.read_csv(data_path + 'train.csv', index_col='id')\ntest = pd.read_csv(data_path + 'test.csv', index_col='id')\nsubmission = pd.read_csv(data_path + 'sample_submission.csv', index_col='id')","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:13:15.826948Z","iopub.execute_input":"2022-07-26T09:13:15.827417Z","iopub.status.idle":"2022-07-26T09:13:19.749790Z","shell.execute_reply.started":"2022-07-26T09:13:15.827377Z","shell.execute_reply":"2022-07-26T09:13:19.748647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:13:20.933820Z","iopub.execute_input":"2022-07-26T09:13:20.934240Z","iopub.status.idle":"2022-07-26T09:13:21.400187Z","shell.execute_reply.started":"2022-07-26T09:13:20.934208Z","shell.execute_reply":"2022-07-26T09:13:21.398913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:13:22.080051Z","iopub.execute_input":"2022-07-26T09:13:22.080435Z","iopub.status.idle":"2022-07-26T09:13:22.091967Z","shell.execute_reply.started":"2022-07-26T09:13:22.080406Z","shell.execute_reply":"2022-07-26T09:13:22.090915Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.shape, test.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:13:27.311060Z","iopub.execute_input":"2022-07-26T09:13:27.311436Z","iopub.status.idle":"2022-07-26T09:13:27.318360Z","shell.execute_reply.started":"2022-07-26T09:13:27.311406Z","shell.execute_reply":"2022-07-26T09:13:27.317254Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:13:51.863572Z","iopub.execute_input":"2022-07-26T09:13:51.863934Z","iopub.status.idle":"2022-07-26T09:13:52.316963Z","shell.execute_reply.started":"2022-07-26T09:13:51.863876Z","shell.execute_reply":"2022-07-26T09:13:52.315741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.nunique()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:14:25.784979Z","iopub.execute_input":"2022-07-26T09:14:25.785424Z","iopub.status.idle":"2022-07-26T09:14:26.364539Z","shell.execute_reply.started":"2022-07-26T09:14:25.785383Z","shell.execute_reply":"2022-07-26T09:14:26.363845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:14:41.391191Z","iopub.execute_input":"2022-07-26T09:14:41.391740Z","iopub.status.idle":"2022-07-26T09:14:41.832077Z","shell.execute_reply.started":"2022-07-26T09:14:41.391708Z","shell.execute_reply":"2022-07-26T09:14:41.830913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:15:34.040959Z","iopub.execute_input":"2022-07-26T09:15:34.041427Z","iopub.status.idle":"2022-07-26T09:15:34.299614Z","shell.execute_reply.started":"2022-07-26T09:15:34.041393Z","shell.execute_reply":"2022-07-26T09:15:34.298091Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y = train['target']\ny","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:15:41.576330Z","iopub.execute_input":"2022-07-26T09:15:41.576761Z","iopub.status.idle":"2022-07-26T09:15:41.586580Z","shell.execute_reply.started":"2022-07-26T09:15:41.576726Z","shell.execute_reply":"2022-07-26T09:15:41.585351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:15:47.904899Z","iopub.execute_input":"2022-07-26T09:15:47.905416Z","iopub.status.idle":"2022-07-26T09:15:47.920633Z","shell.execute_reply.started":"2022-07-26T09:15:47.905370Z","shell.execute_reply":"2022-07-26T09:15:47.919625Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = train.drop(columns = ['target'])\nall_data = pd.concat([train, test])\nall_data.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:18:20.485246Z","iopub.execute_input":"2022-07-26T09:18:20.485762Z","iopub.status.idle":"2022-07-26T09:18:21.020699Z","shell.execute_reply.started":"2022-07-26T09:18:20.485716Z","shell.execute_reply":"2022-07-26T09:18:21.019565Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_len = len(train)\ntrain_len","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:18:50.501915Z","iopub.execute_input":"2022-07-26T09:18:50.502697Z","iopub.status.idle":"2022-07-26T09:18:50.509578Z","shell.execute_reply.started":"2022-07-26T09:18:50.502659Z","shell.execute_reply":"2022-07-26T09:18:50.508333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"all_data.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:20:32.425317Z","iopub.execute_input":"2022-07-26T09:20:32.425665Z","iopub.status.idle":"2022-07-26T09:20:32.432836Z","shell.execute_reply.started":"2022-07-26T09:20:32.425633Z","shell.execute_reply":"2022-07-26T09:20:32.432071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"all_data.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T09:22:50.459407Z","iopub.execute_input":"2022-07-26T09:22:50.459726Z","iopub.status.idle":"2022-07-26T09:22:50.486652Z","shell.execute_reply.started":"2022-07-26T09:22:50.459700Z","shell.execute_reply":"2022-07-26T09:22:50.485463Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}