{"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":"import pandas as pd\nimport numpy as np\n\n# Used to change filepaths\nfrom pathlib import Path\nimport matplotlib.pyplot as plt\nimport IPython\nfrom IPython.display import display\nfrom PIL import Image\n%matplotlib inline\nimport os\nprint(os.listdir(\"../input\"))\n\n","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:03:07.286700Z","iopub.execute_input":"2022-03-09T17:03:07.287449Z","iopub.status.idle":"2022-03-09T17:03:07.297513Z","shell.execute_reply.started":"2022-03-09T17:03:07.287388Z","shell.execute_reply":"2022-03-09T17:03:07.296679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=pd.read_csv(\"../input/ultra-mnist/train.csv\")\ndata.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:03:08.631761Z","iopub.execute_input":"2022-03-09T17:03:08.632645Z","iopub.status.idle":"2022-03-09T17:03:08.665951Z","shell.execute_reply.started":"2022-03-09T17:03:08.632548Z","shell.execute_reply":"2022-03-09T17:03:08.664834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.shape","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:03:09.326469Z","iopub.execute_input":"2022-03-09T17:03:09.326770Z","iopub.status.idle":"2022-03-09T17:03:09.332044Z","shell.execute_reply.started":"2022-03-09T17:03:09.326736Z","shell.execute_reply":"2022-03-09T17:03:09.331436Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sorted_data=data.sort_values(by=[\"id\"]).reset_index()\nsorted_data.drop(columns=[\"index\"],inplace=True)\nsorted_data.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:28:49.737866Z","iopub.execute_input":"2022-03-09T17:28:49.738164Z","iopub.status.idle":"2022-03-09T17:28:49.793993Z","shell.execute_reply.started":"2022-03-09T17:28:49.738125Z","shell.execute_reply":"2022-03-09T17:28:49.793095Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sorted_data[\"id\"][0]","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:28:51.634270Z","iopub.execute_input":"2022-03-09T17:28:51.634747Z","iopub.status.idle":"2022-03-09T17:28:51.641968Z","shell.execute_reply.started":"2022-03-09T17:28:51.634701Z","shell.execute_reply":"2022-03-09T17:28:51.641275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sorted_data[\"digit_sum\"][0]","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:29:57.398130Z","iopub.execute_input":"2022-03-09T17:29:57.398493Z","iopub.status.idle":"2022-03-09T17:29:57.404845Z","shell.execute_reply.started":"2022-03-09T17:29:57.398457Z","shell.execute_reply":"2022-03-09T17:29:57.403969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import Image\nfrom IPython.display import display\n# x = Image(filename='1.png') \n# y = Image(filename='2.png') \n# display(x, y)","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:36:10.076997Z","iopub.execute_input":"2022-03-09T17:36:10.077415Z","iopub.status.idle":"2022-03-09T17:36:10.082589Z","shell.execute_reply.started":"2022-03-09T17:36:10.077379Z","shell.execute_reply":"2022-03-09T17:36:10.081603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for index in range(0,5):\n   \n    print(\"Sum of the below image is : \" + str(sorted_data[\"digit_sum\"][index]))\n    x=Image(filename='../input/ultra-mnist/train/'+sorted_data[\"id\"][index]+'.jpeg',width=1000,height=1000) \n    display(x)","metadata":{"execution":{"iopub.status.busy":"2022-03-09T17:40:38.193595Z","iopub.execute_input":"2022-03-09T17:40:38.194212Z","iopub.status.idle":"2022-03-09T17:40:38.239367Z","shell.execute_reply.started":"2022-03-09T17:40:38.194161Z","shell.execute_reply":"2022-03-09T17:40:38.238460Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}