commit for sync

This commit is contained in:
2026-04-10 13:53:25 +02:00
parent bbd66b0164
commit 999611c254
5 changed files with 508 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "3a384a62",
"metadata": {},
"outputs": [],
@@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "05055b94",
"metadata": {},
"outputs": [],
@@ -29,10 +29,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "13fb9852",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"File loaded successfully!\n"
]
}
],
"source": [
"# read list of boats\n",
"\n",
@@ -47,7 +55,8 @@
"\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))\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",
@@ -56,10 +65,181 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "d6394323",
"execution_count": 29,
"id": "16e39eff",
"metadata": {},
"outputs": [],
"source": [
"printing_df = oars_df['Ruder-ID'].to_frame()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "28fcc50d",
"metadata": {},
"outputs": [],
"source": [
"def create_label_from_oar_id(row):\n",
" oar_id = row['Ruder-ID']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e3992d5c",
"metadata": {},
"outputs": [],
"source": [
"printing_df['label']=printing_df.apply(create_label_from_oar_id,axis=1)"
]
},
{
"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,
"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'"
]
}
],
"source": [
"parent_folder = os.path.dirname(os.getcwd())\n",
"target_path = os.path.join(parent_folder,'LaTex','Ruder-IDs.csv')\n",
@@ -69,7 +249,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": ".venv (3.13.7)",
"language": "python",
"name": "python3"
},
@@ -83,7 +263,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.7"
}
},
"nbformat": 4,

View File

@@ -0,0 +1,253 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "3a384a62",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
"from io import BytesIO\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "05055b94",
"metadata": {},
"outputs": [],
"source": [
"# --- Configuration ---\n",
"NEXTCLOUD_URL = \"https://nextcloud.karnelegger.eu\"\n",
"USERNAME = \"Georg Brantegger\"\n",
"with open('app_pw.txt','r') as f:\n",
" APP_PASSWORD = f.readline()\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "13fb9852",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"File loaded successfully!\n"
]
}
],
"source": [
"# read list of boats\n",
"\n",
"FILE_PATH = \"Shared/Ruderverein/Material/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",
"\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",
" print(\"File loaded successfully!\")\n",
"else:\n",
" print(f\"Failed to fetch file. Status code: {response.status_code}\")\n",
" print(response.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16e39eff",
"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>Bootsname</th>\n",
" <th>Trimmung</th>\n",
" <th>Bootsplatz</th>\n",
" <th>Ruder-ID 1</th>\n",
" <th>Ruder-ID 2</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",
" <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",
" <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",
" <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",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\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",
" <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",
" <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",
" <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",
" <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",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>113 rows × 5 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",
"\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",
"\n",
"[113 rows x 5 columns]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv (3.13.7)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}