{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":61446,"databundleVersionId":6962461,"sourceType":"competition"}],"dockerImageVersionId":30587,"isInternetEnabled":true,"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\n# for 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":"2023-11-17T15:26:27.849980Z","iopub.execute_input":"2023-11-17T15:26:27.850409Z","iopub.status.idle":"2023-11-17T15:26:27.857567Z","shell.execute_reply.started":"2023-11-17T15:26:27.850374Z","shell.execute_reply":"2023-11-17T15:26:27.855935Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv('/kaggle/input/blood-vessel-segmentation/train_rles.csv')\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-11-17T15:26:27.862777Z","iopub.execute_input":"2023-11-17T15:26:27.863467Z","iopub.status.idle":"2023-11-17T15:26:28.610419Z","shell.execute_reply.started":"2023-11-17T15:26:27.863431Z","shell.execute_reply":"2023-11-17T15:26:28.608890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"execution":{"iopub.status.busy":"2023-11-17T15:26:28.612644Z","iopub.execute_input":"2023-11-17T15:26:28.613042Z","iopub.status.idle":"2023-11-17T15:26:28.628442Z","shell.execute_reply.started":"2023-11-17T15:26:28.613010Z","shell.execute_reply":"2023-11-17T15:26:28.627064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Split the 'id' column into separate parts\nsplit_columns = train['id'].str.split('_', expand=True)\n\n# Create new columns for the parts you're interested in\ntrain['kidney_number'] = split_columns[0] + '_' + split_columns[1]\ntrain['type'] = split_columns[2]\n\n# Count the number of unique values for 'kidney_number' and 'type'\nnum_unique_kidney_numbers = train['kidney_number'].nunique()\nnum_unique_types = train['type'].nunique()\nunique_type = train['type'].drop_duplicates()\n\n# Display the counts\nprint(f\"Number of unique kidney numbers: {num_unique_kidney_numbers}\")\nprint(f\"Number of unique types: {num_unique_types}\")\nprint(unique_type)","metadata":{"execution":{"iopub.status.busy":"2023-11-17T15:26:28.630071Z","iopub.execute_input":"2023-11-17T15:26:28.630482Z","iopub.status.idle":"2023-11-17T15:26:28.669658Z","shell.execute_reply.started":"2023-11-17T15:26:28.630450Z","shell.execute_reply":"2023-11-17T15:26:28.668317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Filter the DataFrame to include only rows where 'id' starts with 'Kidney_2'\nkidney_2_rows = train[train['id'].str.startswith('kidney_2')]\n\n# Display the filtered rows\nprint(kidney_2_rows)","metadata":{"execution":{"iopub.status.busy":"2023-11-17T15:26:28.671353Z","iopub.execute_input":"2023-11-17T15:26:28.671707Z","iopub.status.idle":"2023-11-17T15:26:28.689919Z","shell.execute_reply.started":"2023-11-17T15:26:28.671660Z","shell.execute_reply":"2023-11-17T15:26:28.688464Z"},"trusted":true},"execution_count":null,"outputs":[]}]}