{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":28755,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"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\n\n# Use the kagglehub client library to attach Kaggle resources like competitions, datasets, and models to your session\n# Learn more about kagglehub: https://github.com/Kaggle/kagglehub/blob/main/README.md\n\nimport kagglehub\n# kagglehub.dataset_download('<owner>/<dataset-slug>')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:03.508173Z","iopub.execute_input":"2026-09-06T16:50:03.508545Z","iopub.status.idle":"2026-09-06T16:50:05.954135Z","shell.execute_reply.started":"2026-09-06T16:50:03.508503Z","shell.execute_reply":"2026-09-06T16:50:05.95311Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"\nimport seaborn as sns","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:27.654265Z","iopub.execute_input":"2026-09-06T16:50:27.654608Z","iopub.status.idle":"2026-09-06T16:50:28.796856Z","shell.execute_reply.started":"2026-09-06T16:50:27.654571Z","shell.execute_reply":"2026-09-06T16:50:28.795752Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"DATA PATHS","metadata":{}},{"cell_type":"code","source":"## Train Series\ntrain_path = \"/kaggle/input/competitions/rsna-knee-abnormality-detection/train.csv\"\ntrain_series = \"/kaggle/input/competitions/rsna-knee-abnormality-detection/train_series.csv\"\n\ntest_path = \"/kaggle/input/competitions/rsna-knee-abnormality-detection/test.csv\"\ntest_series = \"/kaggle/input/competitions/rsna-knee-abnormality-detection/test_series.csv\"\n\n## Test Series\nt_s = \"/kaggle/input/competitions/rsna-knee-abnormality-detection/test_series\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:31.648114Z","iopub.execute_input":"2026-09-06T16:50:31.648625Z","iopub.status.idle":"2026-09-06T16:50:31.654135Z","shell.execute_reply.started":"2026-09-06T16:50:31.648594Z","shell.execute_reply":"2026-09-06T16:50:31.653162Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"EDA","metadata":{}},{"cell_type":"code","source":"dt = pd.read_csv(train_path)\n\ndts = pd.read_csv(train_series)\n\n\ndtt = pd.read_csv(test_path)\n\ndtts = pd.read_csv(test_series)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:33.998405Z","iopub.execute_input":"2026-09-06T16:50:33.99875Z","iopub.status.idle":"2026-09-06T16:50:34.29746Z","shell.execute_reply.started":"2026-09-06T16:50:33.998723Z","shell.execute_reply":"2026-09-06T16:50:34.296375Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dt.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:35.56408Z","iopub.execute_input":"2026-09-06T16:50:35.564406Z","iopub.status.idle":"2026-09-06T16:50:35.602832Z","shell.execute_reply.started":"2026-09-06T16:50:35.564379Z","shell.execute_reply":"2026-09-06T16:50:35.602Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dts.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:37.156391Z","iopub.execute_input":"2026-09-06T16:50:37.156709Z","iopub.status.idle":"2026-09-06T16:50:37.167581Z","shell.execute_reply.started":"2026-09-06T16:50:37.156683Z","shell.execute_reply":"2026-09-06T16:50:37.16645Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dts[\"SeriesInstanceUID\"][0]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:38.767491Z","iopub.execute_input":"2026-09-06T16:50:38.767816Z","iopub.status.idle":"2026-09-06T16:50:38.774297Z","shell.execute_reply.started":"2026-09-06T16:50:38.767789Z","shell.execute_reply":"2026-09-06T16:50:38.773464Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dtt.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:39.148495Z","iopub.execute_input":"2026-09-06T16:50:39.14883Z","iopub.status.idle":"2026-09-06T16:50:39.157414Z","shell.execute_reply.started":"2026-09-06T16:50:39.148801Z","shell.execute_reply":"2026-09-06T16:50:39.156555Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dtts.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:39.49758Z","iopub.execute_input":"2026-09-06T16:50:39.498435Z","iopub.status.idle":"2026-09-06T16:50:39.508548Z","shell.execute_reply.started":"2026-09-06T16:50:39.498401Z","shell.execute_reply":"2026-09-06T16:50:39.507526Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(f\"Total length of data: {len(dt)}\")\nprint('====================================================================')\n(dt.isna().sum())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:39.907587Z","iopub.execute_input":"2026-09-06T16:50:39.907967Z","iopub.status.idle":"2026-09-06T16:50:39.918872Z","shell.execute_reply.started":"2026-09-06T16:50:39.9079Z","shell.execute_reply":"2026-09-06T16:50:39.917913Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dnna = dt.copy()\ndnna = dnna.dropna()\nprint(f\"Not nan elements: {len(dnna)}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:44.965387Z","iopub.execute_input":"2026-09-06T16:50:44.965739Z","iopub.status.idle":"2026-09-06T16:50:44.977133Z","shell.execute_reply.started":"2026-09-06T16:50:44.965709Z","shell.execute_reply":"2026-09-06T16:50:44.976186Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dnna[[\"ACL\", \"MCL\" ,\"Medial Meniscus\", \"Lateral Meniscus\", \"Medial OA\", \"Lateral OA\", \"PF OA\", \"Effusion\", \"Synovitis\", \"Baker's\", \"Contusion\", \"Fracture\"]].corr()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:50:48.90229Z","iopub.execute_input":"2026-09-06T16:50:48.902646Z","iopub.status.idle":"2026-09-06T16:50:48.923871Z","shell.execute_reply.started":"2026-09-06T16:50:48.902613Z","shell.execute_reply":"2026-09-06T16:50:48.922819Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"check = \"1.2.826.0.1.3680043.8.498.10067514707072572280263481548497591402\"\ncheck_1 = \"1.2.826.0.1.3680043.8.498.10543708582570884867685900269888836671\"\ndt[dt[\"StudyInstanceUID\"] == check]\n#dt[dt[\"SeriesInstanceUID\"] == check_1]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:55:54.441332Z","iopub.execute_input":"2026-09-06T16:55:54.442429Z","iopub.status.idle":"2026-09-06T16:55:54.453348Z","shell.execute_reply.started":"2026-09-06T16:55:54.44239Z","shell.execute_reply":"2026-09-06T16:55:54.452432Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"len(dt['StudyInstanceUID'].unique())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T16:58:29.908463Z","iopub.execute_input":"2026-09-06T16:58:29.908779Z","iopub.status.idle":"2026-09-06T16:58:29.915936Z","shell.execute_reply.started":"2026-09-06T16:58:29.908753Z","shell.execute_reply":"2026-09-06T16:58:29.915027Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"type(dtts[\"StudyInstanceUID\"][1])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-09-06T13:38:58.909394Z","iopub.execute_input":"2026-09-06T13:38:58.909692Z","iopub.status.idle":"2026-09-06T13:38:58.915011Z","shell.execute_reply.started":"2026-09-06T13:38:58.909664Z","shell.execute_reply":"2026-09-06T13:38:58.914336Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":" These are the StudyInstanceUID's\n \n1.2.826.0.1.3680043.8.498.10047035057544427318018579121635276191\n1.2.826.0.1.3680043.8.498.10062861783145312629332250977456991776\n1.2.826.0.1.3680043.8.498.10067514707072572280263481548497591402\n\n\nThe sub folders to StudyInstanceUID's are the SeriesInstanceUID's","metadata":{}},{"cell_type":"markdown","source":"Each of the StudyInstanceUIDs have exactly 5 SeriesInstances\n\nand .dcm is only avalabe for the test bit. \n","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}