{"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\nbase_path = '/kaggle/input/happy-whale-and-dolphin'\nfiles = os.listdir(base_path)\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-03-10T21:55:59.120504Z","iopub.execute_input":"2022-03-10T21:55:59.120816Z","iopub.status.idle":"2022-03-10T21:55:59.125765Z","shell.execute_reply.started":"2022-03-10T21:55:59.120783Z","shell.execute_reply":"2022-03-10T21:55:59.125165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"files","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:00:05.120357Z","iopub.execute_input":"2022-03-10T22:00:05.120823Z","iopub.status.idle":"2022-03-10T22:00:05.128056Z","shell.execute_reply.started":"2022-03-10T22:00:05.120779Z","shell.execute_reply":"2022-03-10T22:00:05.127074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_files = os.listdir(os.path.join(base_path, 'train_images'))\ntest_files = os.listdir(os.path.join(base_path, 'test_images'))","metadata":{"execution":{"iopub.status.busy":"2022-03-10T21:57:10.162748Z","iopub.execute_input":"2022-03-10T21:57:10.163356Z","iopub.status.idle":"2022-03-10T21:57:10.198105Z","shell.execute_reply.started":"2022-03-10T21:57:10.163315Z","shell.execute_reply":"2022-03-10T21:57:10.197040Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(train_files))\nprint(len(test_files))","metadata":{"execution":{"iopub.status.busy":"2022-03-10T21:57:10.998364Z","iopub.execute_input":"2022-03-10T21:57:10.998829Z","iopub.status.idle":"2022-03-10T21:57:11.003542Z","shell.execute_reply.started":"2022-03-10T21:57:10.998796Z","shell.execute_reply":"2022-03-10T21:57:11.002620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nimg = plt.imread(os.path.join(base_path, 'train_images', train_files[0]))\nprint(img.shape)\nplt.imshow(img)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T21:58:24.742262Z","iopub.execute_input":"2022-03-10T21:58:24.742776Z","iopub.status.idle":"2022-03-10T21:58:26.050288Z","shell.execute_reply.started":"2022-03-10T21:58:24.742741Z","shell.execute_reply":"2022-03-10T21:58:26.049411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\n\ndf = pd.read_csv(os.path.join(base_path, 'train.csv'))\ndf_trunc = df.drop(['species'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:09:17.221160Z","iopub.execute_input":"2022-03-10T22:09:17.221436Z","iopub.status.idle":"2022-03-10T22:09:17.287122Z","shell.execute_reply.started":"2022-03-10T22:09:17.221409Z","shell.execute_reply":"2022-03-10T22:09:17.286272Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_trunc['individual_id'].shape","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:11:05.299882Z","iopub.execute_input":"2022-03-10T22:11:05.300477Z","iopub.status.idle":"2022-03-10T22:11:05.306978Z","shell.execute_reply.started":"2022-03-10T22:11:05.300429Z","shell.execute_reply":"2022-03-10T22:11:05.306027Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"arr = df_trunc['individual_id'].unique()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:29:45.810151Z","iopub.execute_input":"2022-03-10T22:29:45.810462Z","iopub.status.idle":"2022-03-10T22:29:45.819494Z","shell.execute_reply.started":"2022-03-10T22:29:45.810432Z","shell.execute_reply":"2022-03-10T22:29:45.818517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"arr.shape","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:29:50.256698Z","iopub.execute_input":"2022-03-10T22:29:50.256959Z","iopub.status.idle":"2022-03-10T22:29:50.262322Z","shell.execute_reply.started":"2022-03-10T22:29:50.256932Z","shell.execute_reply":"2022-03-10T22:29:50.261413Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_trunc['individual_id'].nunique()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:10:46.341817Z","iopub.execute_input":"2022-03-10T22:10:46.342090Z","iopub.status.idle":"2022-03-10T22:10:46.352361Z","shell.execute_reply.started":"2022-03-10T22:10:46.342059Z","shell.execute_reply":"2022-03-10T22:10:46.351736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_update = df.groupby(df['individual_id'] == arr[255])","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:34:37.272525Z","iopub.execute_input":"2022-03-10T22:34:37.272825Z","iopub.status.idle":"2022-03-10T22:34:37.282295Z","shell.execute_reply.started":"2022-03-10T22:34:37.272792Z","shell.execute_reply":"2022-03-10T22:34:37.281487Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_update.count()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:34:37.667944Z","iopub.execute_input":"2022-03-10T22:34:37.668828Z","iopub.status.idle":"2022-03-10T22:34:37.686239Z","shell.execute_reply.started":"2022-03-10T22:34:37.668779Z","shell.execute_reply":"2022-03-10T22:34:37.685376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['species'].unique()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:48:35.118713Z","iopub.execute_input":"2022-03-10T22:48:35.119535Z","iopub.status.idle":"2022-03-10T22:48:35.130228Z","shell.execute_reply.started":"2022-03-10T22:48:35.119480Z","shell.execute_reply":"2022-03-10T22:48:35.129594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['species'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-03-10T22:49:07.271677Z","iopub.execute_input":"2022-03-10T22:49:07.271976Z","iopub.status.idle":"2022-03-10T22:49:07.284858Z","shell.execute_reply.started":"2022-03-10T22:49:07.271944Z","shell.execute_reply":"2022-03-10T22:49:07.283954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}