adapted some code for new folder structure
wrote the enrichment_code for oar_id and boat_places
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,9 +2,10 @@
|
||||
# project specific gitignore entries
|
||||
.venv
|
||||
*.txt
|
||||
*temp/
|
||||
*.xlsx
|
||||
*.pdf
|
||||
*.csv
|
||||
*temp/
|
||||
########################################################################################
|
||||
# project specific gitignore entries
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Ruder-ID
|
||||
S-C2-M-19XX-01-B/S
|
||||
S-Sw-M-201X-01-B/S
|
||||
S-Sw-M-201X-02-B/S
|
||||
@@ -47,20 +46,34 @@ S-C2-H-201X-26-B/S-sk
|
||||
S-C2-H-202X-01-B/S-sk
|
||||
S-C2-H-202X-02-B/S-sk
|
||||
S-C2-H-202X-03-B/S-sk
|
||||
R-Em-H-19XX-01/02
|
||||
R-Em-H-19XX-03/04
|
||||
R-Em-H-19XX-05/06
|
||||
R-Em-H-19XX-07/08
|
||||
R-Cr-H-200X-01/02
|
||||
R-Cr-H-200X-03/04
|
||||
R-Cr-H-200X-05/06
|
||||
R-Cr-H-200X-07/08
|
||||
R-Cr-H-200X-09/10
|
||||
R-Cr-H-200X-11/12
|
||||
R-Cr-H-200X-13/14
|
||||
R-C2-H-201X-01/02-sk
|
||||
R-C2-H-201X-03/04-sk
|
||||
R-C2-H-201X-05/06-sk
|
||||
R-C2-H-201X-07/08-sk
|
||||
R-C2-H-201X-09/10-sk
|
||||
R-C2-H-201X-11/12-sk
|
||||
R-Em-H-19XX-00/01
|
||||
R-Em-H-19XX-02/3
|
||||
R-Em-H-19XX-02/03
|
||||
R-Em-H-19XX-04/5
|
||||
R-Em-H-19XX-04/05
|
||||
R-Em-H-19XX-06/7
|
||||
R-Em-H-19XX-06/07
|
||||
R-Em-H-19XX-08/9
|
||||
R-Cr-H-200X-00/01
|
||||
R-Cr-H-200X-02/3
|
||||
R-Cr-H-200X-02/03
|
||||
R-Cr-H-200X-04/5
|
||||
R-Cr-H-200X-04/05
|
||||
R-Cr-H-200X-06/7
|
||||
R-Cr-H-200X-06/07
|
||||
R-Cr-H-200X-08/9
|
||||
R-Cr-H-200X-08/09
|
||||
R-Cr-H-200X-10/11
|
||||
R-Cr-H-200X-12/13
|
||||
R-Cr-H-200X-14/15
|
||||
R-C2-H-201X-00/01-sk
|
||||
R-C2-H-201X-02/3-sk
|
||||
R-C2-H-201X-02/03-sk
|
||||
R-C2-H-201X-04/5-sk
|
||||
R-C2-H-201X-04/05-sk
|
||||
R-C2-H-201X-06/7-sk
|
||||
R-C2-H-201X-06/07-sk
|
||||
R-C2-H-201X-08/9-sk
|
||||
R-C2-H-201X-08/09-sk
|
||||
R-C2-H-201X-10/11-sk
|
||||
R-C2-H-201X-12/13-sk
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# Modern Nextcloud WebDAV endpoint format:\n",
|
||||
"WEBDAV_BASE_URL = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/Shared/Ruderverein/Videoanalyse\""
|
||||
"WEBDAV_BASE_URL = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/Shared/Ruderverein/02_Athlet:innen/01_Videoanalyse\""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 25,
|
||||
"id": "f46948ac",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 26,
|
||||
"id": "3a1de802",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -28,14 +28,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 27,
|
||||
"id": "1fdfef34",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"File loaded successfully!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# read list of boats\n",
|
||||
"\n",
|
||||
"FILE_PATH = \"Shared/Ruderverein/Material/Bootsliste.xlsx\"\n",
|
||||
"FILE_PATH = \"Shared/Ruderverein/01_Material/01_Bootsliste.xlsx\"\n",
|
||||
"\n",
|
||||
"# Build the WebDAV URL\n",
|
||||
"# Note: Path should be URL-encoded if it contains spaces or special characters\n",
|
||||
@@ -55,7 +63,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 28,
|
||||
"id": "80f97e18",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -80,7 +88,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 29,
|
||||
"id": "70fb2327",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -90,7 +98,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 30,
|
||||
"id": "bf18a0fd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -99,45 +107,65 @@
|
||||
"variants = []\n",
|
||||
"places = []\n",
|
||||
"\n",
|
||||
"for boat_name in df['Name'].unique():\n",
|
||||
" number_seats = df.loc[df['Name']==boat_name,'number_seats'].values[0]\n",
|
||||
" variable = df.loc[df['Name']==boat_name,'variable'].values[0]\n",
|
||||
"for boat_name in boats_df['Name'].unique():\n",
|
||||
" number_seats = boats_df.loc[boats_df['Name']==boat_name,'number_seats'].values[0]\n",
|
||||
" variable = boats_df.loc[boats_df['Name']==boat_name,'variable'].values[0]\n",
|
||||
"\n",
|
||||
" if bool(variable) is False:\n",
|
||||
" for place in range(1,number_seats+1):\n",
|
||||
" boat_names.append(boat_name)\n",
|
||||
" boat_names.append(boat_name.strip())\n",
|
||||
" variants.append(f\"{number_seats}x\")\n",
|
||||
" places.append(place)\n",
|
||||
" elif bool(variable) is True:\n",
|
||||
" for place in range(1,number_seats+1):\n",
|
||||
" boat_names.append(boat_name)\n",
|
||||
" boat_names.append(boat_name.strip())\n",
|
||||
" variants.append(f\"{number_seats}x\")\n",
|
||||
" places.append(place)\n",
|
||||
" for place in range(1,number_seats+1):\n",
|
||||
" boat_names.append(boat_name)\n",
|
||||
" boat_names.append(boat_name.strip())\n",
|
||||
" variants.append(f\"{number_seats}-\")\n",
|
||||
" places.append(place)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 31,
|
||||
"id": "85059518",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data_dict = {'Bootsname':boat_names,'Trimmung':variants,'Bootsplatz':places,'Ruder-ID':[None for _ in boat_names]}\n",
|
||||
"data_dict = {'Bootsname':boat_names,'Trimmung':variants,'Bootsplatz':places,'Ruder-ID Macon':[None for _ in boat_names],'Ruder-ID Hacke':[None for _ in boat_names]}\n",
|
||||
"places_df = pd.DataFrame(data_dict)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 55,
|
||||
"id": "7c4f5c01",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"places_df['sort_value'] = places_df['Bootsname'].str.lower()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 56,
|
||||
"id": "edd22b3f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"places_df.sort_values(by='sort_value',inplace=True,ignore_index=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"id": "3071bf52",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"places_df.to_excel('temp.xlsx')"
|
||||
"places_df[['Bootsname','Trimmung','Bootsplatz','Ruder-ID Macon','Ruder-ID Hacke']].to_excel('temp.xlsx')"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 9,
|
||||
"id": "3a384a62",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 10,
|
||||
"id": "05055b94",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -44,7 +44,7 @@
|
||||
"source": [
|
||||
"# read list of boats\n",
|
||||
"\n",
|
||||
"FILE_PATH = \"Shared/Ruderverein/Material/Ruderliste.xlsx\"\n",
|
||||
"FILE_PATH = \"Shared/Ruderverein/01_Material/02_Ruderliste.xlsx\"\n",
|
||||
"\n",
|
||||
"# Build the WebDAV URL\n",
|
||||
"# Note: Path should be URL-encoded if it contains spaces or special characters\n",
|
||||
@@ -56,7 +56,6 @@
|
||||
"if response.status_code == 200:\n",
|
||||
" # Use BytesIO to turn the raw binary content into a file-like object\n",
|
||||
" oars_df = pd.read_excel(BytesIO(response.content),sheet_name='Ruder')\n",
|
||||
" places_df = pd.read_excel(BytesIO(response.content),sheet_name='Bootsplatz_Zuordnung')\n",
|
||||
" print(\"File loaded successfully!\")\n",
|
||||
"else:\n",
|
||||
" print(f\"Failed to fetch file. Status code: {response.status_code}\")\n",
|
||||
@@ -65,7 +64,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"execution_count": 12,
|
||||
"id": "16e39eff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -75,18 +74,31 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 25,
|
||||
"id": "28fcc50d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def create_label_from_oar_id(row):\n",
|
||||
" oar_id = row['Ruder-ID']"
|
||||
" oar_id = row['Ruder-ID']\n",
|
||||
"\n",
|
||||
" parts = oar_id.split('-')\n",
|
||||
" if parts[0] == 'S':\n",
|
||||
" parts[5] = 'B/S'\n",
|
||||
" elif parts[0] == 'R':\n",
|
||||
" if int(parts[4])%2 == 0:\n",
|
||||
" parts[4] = parts[4] +'/' f'{int(parts[4])+1}'.zfill(2)\n",
|
||||
" else:\n",
|
||||
" parts[4] = f'{int(parts[4])-1}'.zfill(2)+'/'+parts[4]\n",
|
||||
" parts.remove(parts[5])\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" return '-'.join(parts)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 26,
|
||||
"id": "e3992d5c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -96,160 +108,21 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"id": "43132d73",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>Ruder-ID</th>\n",
|
||||
" <th>label</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>S-C2-M-19XX-01-B</td>\n",
|
||||
" <td>S-C2-M-19XX-01</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>S-C2-M-19XX-01-S</td>\n",
|
||||
" <td>S-C2-M-19XX-01</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>S-Sw-M-201X-01-B</td>\n",
|
||||
" <td>S-Sw-M-201X-01</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>S-Sw-M-201X-01-S</td>\n",
|
||||
" <td>S-Sw-M-201X-01</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>S-Sw-M-201X-02-B</td>\n",
|
||||
" <td>S-Sw-M-201X-02</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>...</th>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>125</th>\n",
|
||||
" <td>R-C2-H-201X-08-B-sk</td>\n",
|
||||
" <td>R-C2-H-201X-08-B</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>126</th>\n",
|
||||
" <td>R-C2-H-201X-09-S-sk</td>\n",
|
||||
" <td>R-C2-H-201X-09-S</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>127</th>\n",
|
||||
" <td>R-C2-H-201X-10-B-sk</td>\n",
|
||||
" <td>R-C2-H-201X-10-B</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>128</th>\n",
|
||||
" <td>R-C2-H-201X-11-S-sk</td>\n",
|
||||
" <td>R-C2-H-201X-11-S</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>129</th>\n",
|
||||
" <td>R-C2-H-201X-12-B-sk</td>\n",
|
||||
" <td>R-C2-H-201X-12-B</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"<p>130 rows × 2 columns</p>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Ruder-ID label\n",
|
||||
"0 S-C2-M-19XX-01-B S-C2-M-19XX-01\n",
|
||||
"1 S-C2-M-19XX-01-S S-C2-M-19XX-01\n",
|
||||
"2 S-Sw-M-201X-01-B S-Sw-M-201X-01\n",
|
||||
"3 S-Sw-M-201X-01-S S-Sw-M-201X-01\n",
|
||||
"4 S-Sw-M-201X-02-B S-Sw-M-201X-02\n",
|
||||
".. ... ...\n",
|
||||
"125 R-C2-H-201X-08-B-sk R-C2-H-201X-08-B\n",
|
||||
"126 R-C2-H-201X-09-S-sk R-C2-H-201X-09-S\n",
|
||||
"127 R-C2-H-201X-10-B-sk R-C2-H-201X-10-B\n",
|
||||
"128 R-C2-H-201X-11-S-sk R-C2-H-201X-11-S\n",
|
||||
"129 R-C2-H-201X-12-B-sk R-C2-H-201X-12-B\n",
|
||||
"\n",
|
||||
"[130 rows x 2 columns]"
|
||||
]
|
||||
},
|
||||
"execution_count": 34,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"printing_df"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 28,
|
||||
"id": "d6394323",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "KeyError",
|
||||
"evalue": "'Ruder-ID'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
||||
"\u001b[31mKeyError\u001b[39m Traceback (most recent call last)",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/Coding local/Python-RV/.venv/lib/python3.13/site-packages/pandas/core/indexes/base.py:3641\u001b[39m, in \u001b[36mIndex.get_loc\u001b[39m\u001b[34m(self, key)\u001b[39m\n\u001b[32m 3640\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m3641\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_engine\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcasted_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 3642\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32mpandas/_libs/index.pyx:168\u001b[39m, in \u001b[36mpandas._libs.index.IndexEngine.get_loc\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m--> \u001b[39m\u001b[32m168\u001b[39m \u001b[33m'Could not get source, probably due dynamically evaluated source code.'\u001b[39m\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32mpandas/_libs/index.pyx:197\u001b[39m, in \u001b[36mpandas._libs.index.IndexEngine.get_loc\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m--> \u001b[39m\u001b[32m197\u001b[39m \u001b[33m'Could not get source, probably due dynamically evaluated source code.'\u001b[39m\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32mpandas/_libs/hashtable_class_helper.pxi:7668\u001b[39m, in \u001b[36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m-> \u001b[39m\u001b[32m7668\u001b[39m \u001b[33m'Could not get source, probably due dynamically evaluated source code.'\u001b[39m\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32mpandas/_libs/hashtable_class_helper.pxi:7676\u001b[39m, in \u001b[36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m-> \u001b[39m\u001b[32m7676\u001b[39m \u001b[33m'Could not get source, probably due dynamically evaluated source code.'\u001b[39m\n",
|
||||
"\u001b[31mKeyError\u001b[39m: 'Ruder-ID'",
|
||||
"\nThe above exception was the direct cause of the following exception:\n",
|
||||
"\u001b[31mKeyError\u001b[39m Traceback (most recent call last)",
|
||||
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[6]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m parent_folder = os.path.dirname(os.getcwd())\n\u001b[32m 2\u001b[39m target_path = os.path.join(parent_folder,\u001b[33m'LaTex'\u001b[39m,\u001b[33m'Ruder-IDs.csv'\u001b[39m)\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m oars_df[\u001b[33m'Ruder-ID'\u001b[39m].to_csv(target_path,index=\u001b[38;5;28;01mFalse\u001b[39;00m)\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/Coding local/Python-RV/.venv/lib/python3.13/site-packages/pandas/core/frame.py:4378\u001b[39m, in \u001b[36mDataFrame.__getitem__\u001b[39m\u001b[34m(self, key)\u001b[39m\n\u001b[32m 4374\u001b[39m \n\u001b[32m 4375\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m is_single_key:\n\u001b[32m 4376\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m self.columns.nlevels > \u001b[32m1\u001b[39m:\n\u001b[32m 4377\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m self._getitem_multilevel(key)\n\u001b[32m-> \u001b[39m\u001b[32m4378\u001b[39m indexer = self.columns.get_loc(key)\n\u001b[32m 4379\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m is_integer(indexer):\n\u001b[32m 4380\u001b[39m indexer = [indexer]\n\u001b[32m 4381\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/Coding local/Python-RV/.venv/lib/python3.13/site-packages/pandas/core/indexes/base.py:3648\u001b[39m, in \u001b[36mIndex.get_loc\u001b[39m\u001b[34m(self, key)\u001b[39m\n\u001b[32m 3643\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(casted_key, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m (\n\u001b[32m 3644\u001b[39m \u001b[38;5;28misinstance\u001b[39m(casted_key, abc.Iterable)\n\u001b[32m 3645\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28many\u001b[39m(\u001b[38;5;28misinstance\u001b[39m(x, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m casted_key)\n\u001b[32m 3646\u001b[39m ):\n\u001b[32m 3647\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m InvalidIndexError(key) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01merr\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m3648\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(key) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01merr\u001b[39;00m\n\u001b[32m 3649\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[32m 3650\u001b[39m \u001b[38;5;66;03m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[32m 3651\u001b[39m \u001b[38;5;66;03m# InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[32m 3652\u001b[39m \u001b[38;5;66;03m# the TypeError.\u001b[39;00m\n\u001b[32m 3653\u001b[39m \u001b[38;5;28mself\u001b[39m._check_indexing_error(key)\n",
|
||||
"\u001b[31mKeyError\u001b[39m: 'Ruder-ID'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"parent_folder = os.path.dirname(os.getcwd())\n",
|
||||
"target_path = os.path.join(parent_folder,'LaTex','Ruder-IDs.csv')\n",
|
||||
"oars_df['Ruder-ID'].to_csv(target_path,index=False)"
|
||||
"export_df = printing_df.drop_duplicates(subset='label')\n",
|
||||
"export_df['label'].to_csv(target_path,index=False,header=False)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv (3.13.7)",
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -263,7 +136,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.13.7"
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 40,
|
||||
"id": "3a384a62",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -10,12 +10,13 @@
|
||||
"import requests\n",
|
||||
"import pandas as pd\n",
|
||||
"from io import BytesIO\n",
|
||||
"import os"
|
||||
"import os\n",
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 41,
|
||||
"id": "05055b94",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -29,7 +30,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"id": "13fb9852",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -37,6 +38,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"File loaded successfully!\n",
|
||||
"File loaded successfully!\n"
|
||||
]
|
||||
}
|
||||
@@ -44,28 +46,45 @@
|
||||
"source": [
|
||||
"# read list of boats\n",
|
||||
"\n",
|
||||
"FILE_PATH = \"Shared/Ruderverein/Material/Ruderliste.xlsx\"\n",
|
||||
"FILE_PATH_1 = \"Shared/Ruderverein/01_Material/02_Ruderliste.xlsx\"\n",
|
||||
"\n",
|
||||
"# Build the WebDAV URL\n",
|
||||
"# Note: Path should be URL-encoded if it contains spaces or special characters\n",
|
||||
"webdav_url = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/{FILE_PATH}\"\n",
|
||||
"webdav_url = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/{FILE_PATH_1}\"\n",
|
||||
"\n",
|
||||
"# --- The Request ---\n",
|
||||
"response = requests.get(webdav_url, auth=(USERNAME, APP_PASSWORD))\n",
|
||||
"\n",
|
||||
"if response.status_code == 200:\n",
|
||||
" # Use BytesIO to turn the raw binary content into a file-like object\n",
|
||||
" oars_df = pd.read_excel(BytesIO(response.content),sheet_name='Ruder')\n",
|
||||
" places_df = pd.read_excel(BytesIO(response.content),sheet_name='Bootsplatz_Zuordnung')\n",
|
||||
" oars_df = pd.read_excel(BytesIO(response.content),sheet_name='Ruder',index_col=0)\n",
|
||||
" print(\"File loaded successfully!\")\n",
|
||||
"else:\n",
|
||||
" print(f\"Failed to fetch file. Status code: {response.status_code}\")\n",
|
||||
" print(response.text)"
|
||||
" print(response.text)\n",
|
||||
"\n",
|
||||
"FILE_PATH_2 = \"Shared/Ruderverein/01_Material/03_Bootsplatz-Ruder-Zuordnung.xlsx\"\n",
|
||||
"\n",
|
||||
"# Build the WebDAV URL\n",
|
||||
"# Note: Path should be URL-encoded if it contains spaces or special characters\n",
|
||||
"webdav_url = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/{FILE_PATH_2}\"\n",
|
||||
"\n",
|
||||
"# --- The Request ---\n",
|
||||
"response = requests.get(webdav_url, auth=(USERNAME, APP_PASSWORD))\n",
|
||||
"\n",
|
||||
"if response.status_code == 200:\n",
|
||||
" # Use BytesIO to turn the raw binary content into a file-like object\n",
|
||||
" places_df = pd.read_excel(BytesIO(response.content),sheet_name='Bootsplatz_Zuordnung').fillna('')\n",
|
||||
" print(\"File loaded successfully!\")\n",
|
||||
"else:\n",
|
||||
" print(f\"Failed to fetch file. Status code: {response.status_code}\")\n",
|
||||
" print(response.text)\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 43,
|
||||
"id": "16e39eff",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -90,52 +109,88 @@
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>Bootsname</th>\n",
|
||||
" <th>Trimmung</th>\n",
|
||||
" <th>Bootsplatz</th>\n",
|
||||
" <th>Ruder-ID 1</th>\n",
|
||||
" <th>Ruder-ID 2</th>\n",
|
||||
" <th>Länge Ruder gesamt</th>\n",
|
||||
" <th>Länge Innenhebel</th>\n",
|
||||
" <th>Anlage</th>\n",
|
||||
" <th>Länge Ruder min</th>\n",
|
||||
" <th>Länge Ruder max</th>\n",
|
||||
" <th>Skinny Typ</th>\n",
|
||||
" <th>Bootsplatz 1</th>\n",
|
||||
" <th>Bootsplatz 2</th>\n",
|
||||
" <th>Bootsplatz 3</th>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Ruder-ID</th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Angie</td>\n",
|
||||
" <td>1x</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>S-Cr-M-200X-07-X</td>\n",
|
||||
" <td>S-C2-H-201X-16-X</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>Architekten Lechner</td>\n",
|
||||
" <td>4x</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>S-C2-H-201X-01-X</td>\n",
|
||||
" <th>R-C2-H-201X-01-S-sk</th>\n",
|
||||
" <td>370.5</td>\n",
|
||||
" <td>111.0</td>\n",
|
||||
" <td>+1</td>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>375.0</td>\n",
|
||||
" <td>MEDFLEX</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>Architekten Lechner</td>\n",
|
||||
" <td>4x</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>S-C2-H-201X-02-X</td>\n",
|
||||
" <th>R-C2-H-201X-02-B-sk</th>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>111.0</td>\n",
|
||||
" <td>-3,5</td>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>375.0</td>\n",
|
||||
" <td>MEDFLEX</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>Architekten Lechner</td>\n",
|
||||
" <td>4x</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" <td>S-C2-H-201X-03-X</td>\n",
|
||||
" <th>R-C2-H-201X-03-S-sk</th>\n",
|
||||
" <td>370.5</td>\n",
|
||||
" <td>111.5</td>\n",
|
||||
" <td>+1</td>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>375.0</td>\n",
|
||||
" <td>MEDFLEX</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>Architekten Lechner</td>\n",
|
||||
" <td>4x</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>S-C2-H-201X-04-X</td>\n",
|
||||
" <th>R-C2-H-201X-04-B-sk</th>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>111.5</td>\n",
|
||||
" <td>-2</td>\n",
|
||||
" <td>370.0</td>\n",
|
||||
" <td>375.0</td>\n",
|
||||
" <td>MEDFLEX</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>R-C2-H-201X-05-S-sk</th>\n",
|
||||
" <td>374.7</td>\n",
|
||||
" <td>115.0</td>\n",
|
||||
" <td>+2</td>\n",
|
||||
" <td>373.0</td>\n",
|
||||
" <td>378.0</td>\n",
|
||||
" <td>MEDFLEX</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -145,93 +200,208 @@
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>108</th>\n",
|
||||
" <td>Villacher Faschingsgilde</td>\n",
|
||||
" <td>2x</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <th>S-Sw-M-201X-02-S</th>\n",
|
||||
" <td>294.0</td>\n",
|
||||
" <td>88.0</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>109</th>\n",
|
||||
" <td>Villacher Faschingsgilde</td>\n",
|
||||
" <td>2x</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>S-Sw-M-201X-03-B</th>\n",
|
||||
" <td>294.0</td>\n",
|
||||
" <td>88.0</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>110</th>\n",
|
||||
" <td>Villacher Faschingsgilde</td>\n",
|
||||
" <td>2-</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <th>S-Sw-M-201X-03-S</th>\n",
|
||||
" <td>294.0</td>\n",
|
||||
" <td>88.0</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>111</th>\n",
|
||||
" <td>Villacher Faschingsgilde</td>\n",
|
||||
" <td>2-</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>S-Sw-M-201X-04-B</th>\n",
|
||||
" <td>294.0</td>\n",
|
||||
" <td>88.0</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>112</th>\n",
|
||||
" <td>Zernatto</td>\n",
|
||||
" <td>1x</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <th>S-Sw-M-201X-04-S</th>\n",
|
||||
" <td>294.0</td>\n",
|
||||
" <td>88.0</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"<p>113 rows × 5 columns</p>\n",
|
||||
"<p>134 rows × 9 columns</p>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Bootsname Trimmung Bootsplatz Ruder-ID 1 \\\n",
|
||||
"0 Angie 1x 1 S-Cr-M-200X-07-X \n",
|
||||
"1 Architekten Lechner 4x 1 S-C2-H-201X-01-X \n",
|
||||
"2 Architekten Lechner 4x 2 S-C2-H-201X-02-X \n",
|
||||
"3 Architekten Lechner 4x 3 S-C2-H-201X-03-X \n",
|
||||
"4 Architekten Lechner 4x 4 S-C2-H-201X-04-X \n",
|
||||
".. ... ... ... ... \n",
|
||||
"108 Villacher Faschingsgilde 2x 1 NaN \n",
|
||||
"109 Villacher Faschingsgilde 2x 2 NaN \n",
|
||||
"110 Villacher Faschingsgilde 2- 1 NaN \n",
|
||||
"111 Villacher Faschingsgilde 2- 2 NaN \n",
|
||||
"112 Zernatto 1x 1 NaN \n",
|
||||
" Länge Ruder gesamt Länge Innenhebel Anlage \\\n",
|
||||
"Ruder-ID \n",
|
||||
"R-C2-H-201X-01-S-sk 370.5 111.0 +1 \n",
|
||||
"R-C2-H-201X-02-B-sk 370.0 111.0 -3,5 \n",
|
||||
"R-C2-H-201X-03-S-sk 370.5 111.5 +1 \n",
|
||||
"R-C2-H-201X-04-B-sk 370.0 111.5 -2 \n",
|
||||
"R-C2-H-201X-05-S-sk 374.7 115.0 +2 \n",
|
||||
"... ... ... ... \n",
|
||||
"S-Sw-M-201X-02-S 294.0 88.0 NaN \n",
|
||||
"S-Sw-M-201X-03-B 294.0 88.0 NaN \n",
|
||||
"S-Sw-M-201X-03-S 294.0 88.0 NaN \n",
|
||||
"S-Sw-M-201X-04-B 294.0 88.0 NaN \n",
|
||||
"S-Sw-M-201X-04-S 294.0 88.0 NaN \n",
|
||||
"\n",
|
||||
" Ruder-ID 2 \n",
|
||||
"0 S-C2-H-201X-16-X \n",
|
||||
"1 NaN \n",
|
||||
"2 NaN \n",
|
||||
"3 NaN \n",
|
||||
"4 NaN \n",
|
||||
".. ... \n",
|
||||
"108 NaN \n",
|
||||
"109 NaN \n",
|
||||
"110 NaN \n",
|
||||
"111 NaN \n",
|
||||
"112 NaN \n",
|
||||
" Länge Ruder min Länge Ruder max Skinny Typ \\\n",
|
||||
"Ruder-ID \n",
|
||||
"R-C2-H-201X-01-S-sk 370.0 375.0 MEDFLEX \n",
|
||||
"R-C2-H-201X-02-B-sk 370.0 375.0 MEDFLEX \n",
|
||||
"R-C2-H-201X-03-S-sk 370.0 375.0 MEDFLEX \n",
|
||||
"R-C2-H-201X-04-B-sk 370.0 375.0 MEDFLEX \n",
|
||||
"R-C2-H-201X-05-S-sk 373.0 378.0 MEDFLEX \n",
|
||||
"... ... ... ... \n",
|
||||
"S-Sw-M-201X-02-S NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-03-B NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-03-S NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-04-B NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-04-S NaN NaN NaN \n",
|
||||
"\n",
|
||||
"[113 rows x 5 columns]"
|
||||
" Bootsplatz 1 Bootsplatz 2 Bootsplatz 3 \n",
|
||||
"Ruder-ID \n",
|
||||
"R-C2-H-201X-01-S-sk NaN NaN NaN \n",
|
||||
"R-C2-H-201X-02-B-sk NaN NaN NaN \n",
|
||||
"R-C2-H-201X-03-S-sk NaN NaN NaN \n",
|
||||
"R-C2-H-201X-04-B-sk NaN NaN NaN \n",
|
||||
"R-C2-H-201X-05-S-sk NaN NaN NaN \n",
|
||||
"... ... ... ... \n",
|
||||
"S-Sw-M-201X-02-S NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-03-B NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-03-S NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-04-B NaN NaN NaN \n",
|
||||
"S-Sw-M-201X-04-S NaN NaN NaN \n",
|
||||
"\n",
|
||||
"[134 rows x 9 columns]"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": []
|
||||
"source": [
|
||||
"oars_df"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"id": "da9397a8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"places_df['Bootsplatz-Label'] = places_df.apply(lambda row: '_'.join(row[['Bootsname','Trimmung','Bootsplatz']].astype(str).to_list()),axis=1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"id": "43ffb028",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"my_dict = {key:[] for key in oars_df.index.values}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"for oar_id in my_dict.keys():\n",
|
||||
" relevant_part = '-'.join(oar_id.split('-')[:5])\n",
|
||||
"\n",
|
||||
" for i,row in places_df.iterrows():\n",
|
||||
" test_macon = '-'.join(row['Ruder-ID Macon'].split('-')[:5])\n",
|
||||
" test_hacke = '-'.join(row['Ruder-ID Hacke'].split('-')[:5])\n",
|
||||
" if (relevant_part == test_macon ) | (relevant_part == test_hacke):\n",
|
||||
" my_dict[oar_id].append(row['Bootsplatz-Label'])\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"id": "0b3f5068",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for oar_id in my_dict.keys():\n",
|
||||
" places_list = np.array(my_dict[oar_id])\n",
|
||||
" boat_sizes = [place_label.split('_')[1][0] if len(place_label)>0 else '' for place_label in places_list]\n",
|
||||
" my_dict[oar_id] = np.flip(places_list[np.argsort(np.array(boat_sizes))])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 47,
|
||||
"id": "3a7eb82e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"my_df = pd.DataFrame.from_dict(my_dict, orient='index',columns=['Bootsplatz 1','Bootsplatz 2','Bootsplatz 3'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"id": "d85765c4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"oars_df[['Bootsplatz 1','Bootsplatz 2','Bootsplatz 3']] = my_df[['Bootsplatz 1','Bootsplatz 2','Bootsplatz 3']]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 52,
|
||||
"id": "b6848ae9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"oars_df.to_csv('temp.csv',index=True,sep=';',decimal=',')"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv (3.13.7)",
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -245,7 +415,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.13.7"
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user