{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":71549,"databundleVersionId":8561470,"sourceType":"competition"},{"sourceId":195192038,"sourceType":"kernelVersion"}],"dockerImageVersionId":30761,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\n\ndf=pd.read_csv('/kaggle/input/submissionrsna2024/submission.csv')\ndf","metadata":{"execution":{"iopub.status.busy":"2024-09-04T04:43:01.764094Z","iopub.execute_input":"2024-09-04T04:43:01.764542Z","iopub.status.idle":"2024-09-04T04:43:01.794854Z","shell.execute_reply.started":"2024-09-04T04:43:01.764501Z","shell.execute_reply":"2024-09-04T04:43:01.793717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n# Extract components from 'row_id'\ndf['study_id'] = df['row_id'].apply(lambda x: x.split('_')[0])\ndf['condition'] = df['row_id'].apply(lambda x: '_'.join(x.split('_')[1:-1]))\ndf['level_range'] = df['row_id'].apply(lambda x: x.split('_')[-1])\n\n# Sort the DataFrame by 'condition' and 'level_range'\ndf_sorted = df.sort_values(by=['condition', 'level_range'])\n\n# Drop the auxiliary columns used for sorting if needed\ndf_sorted = df_sorted.drop(columns=['study_id', 'condition', 'level_range'])\n\n# Display the sorted DataFrame\nprint(df_sorted)\n","metadata":{"execution":{"iopub.status.busy":"2024-09-04T04:43:03.950635Z","iopub.execute_input":"2024-09-04T04:43:03.951086Z","iopub.status.idle":"2024-09-04T04:43:03.969191Z","shell.execute_reply.started":"2024-09-04T04:43:03.951044Z","shell.execute_reply":"2024-09-04T04:43:03.967988Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_sorted.to_csv(\"submission.csv\", index=False)\n","metadata":{"execution":{"iopub.status.busy":"2024-09-04T04:44:58.466024Z","iopub.execute_input":"2024-09-04T04:44:58.466473Z","iopub.status.idle":"2024-09-04T04:44:58.473976Z","shell.execute_reply.started":"2024-09-04T04:44:58.466431Z","shell.execute_reply":"2024-09-04T04:44:58.472703Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2=pd.read_csv('/kaggle/working/submission.csv')\nprint(df2)","metadata":{"execution":{"iopub.status.busy":"2024-09-04T04:44:59.956746Z","iopub.execute_input":"2024-09-04T04:44:59.957588Z","iopub.status.idle":"2024-09-04T04:44:59.971711Z","shell.execute_reply.started":"2024-09-04T04:44:59.957535Z","shell.execute_reply":"2024-09-04T04:44:59.970502Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}