diff --git a/.gitignore b/.gitignore index 030381b..1d3a733 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.txt *temp/ *.xlsx +*.pdf ######################################################################################## # project specific gitignore entries diff --git a/LaTex/Ruder-IDs.csv b/LaTex/Ruder-IDs.csv index ec60834..251ae94 100644 --- a/LaTex/Ruder-IDs.csv +++ b/LaTex/Ruder-IDs.csv @@ -1,15 +1,66 @@ Ruder-ID -S-C2-H-201X-98-B-sk -S-C2-H-201X-97-B-sk -S-C2-H-201X-99-B-sk -S-C2-H-201X-96-B-sk -S-C2-H-201X-98-B-sk -S-C2-H-201X-97-B-sk -S-C2-H-201X-99-B-sk -S-C2-H-201X-96-B-sk -S-C2-H-201X-98-B-sk -S-C2-H-201X-97-B-sk -S-C2-H-201X-99-B-sk -S-C2-H-201X-96-B-sk -S-C2-H-201X-98-B-sk -S-C2-H-201X-97-B-sk +S-C2-M-19XX-01-B/S +S-Sw-M-201X-01-B/S +S-Sw-M-201X-02-B/S +S-Sw-M-201X-03-B/S +S-Sw-M-201X-04-B/S +S-Cr-M-200X-01-B/S +S-Cr-M-200X-02-B/S +S-Cr-M-200X-03-B/S +S-Cr-M-200X-04-B/S +S-Cr-M-200X-05-B/S +S-Cr-M-200X-06-B/S +S-Cr-M-200X-07-B/S +S-Cr-M-200X-08-B/S +S-Cr-M-200X-09-B/S +S-Cr-M-200X-10-B/S +S-Cr-M-200X-11-B/S +S-Cr-H-200X-01-B/S +S-Cr-H-200X-02-B/S +S-Cr-H-200X-03-B/S +S-Cr-H-200X-04-B/S +S-Cr-H-200X-05-B/S +S-C2-H-201X-01-B/S +S-C2-H-201X-02-B/S +S-C2-H-201X-03-B/S +S-C2-H-201X-04-B/S +S-C2-H-201X-05-B/S +S-C2-H-201X-06-B/S +S-C2-H-201X-07-B/S +S-C2-H-201X-08-B/S +S-C2-H-201X-09-B/S +S-C2-H-201X-10-B/S +S-C2-H-201X-11-B/S +S-C2-H-201X-12-B/S +S-C2-H-201X-13-B/S +S-C2-H-201X-14-B/S +S-C2-H-201X-15-B/S +S-C2-H-201X-16-B/S +S-C2-H-201X-17-B/S +S-C2-H-201X-20-B/S-sk +S-C2-H-201X-21-B/S-sk +S-C2-H-201X-22-B/S-sk +S-C2-H-201X-23-B/S-sk +S-C2-H-201X-24-B/S-sk +S-C2-H-201X-25-B/S-sk +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 \ No newline at end of file diff --git a/LaTex/print_Ruder-IDs.pdf b/LaTex/print_Ruder-IDs.pdf index 74ec78c..9972171 100644 Binary files a/LaTex/print_Ruder-IDs.pdf and b/LaTex/print_Ruder-IDs.pdf differ diff --git a/Nextcloud_Material/create_oar_ID_csv_for_printing.ipynb b/Nextcloud_Material/create_oar_ID_csv_for_printing.ipynb index c0a22ab..76c6048 100644 --- a/Nextcloud_Material/create_oar_ID_csv_for_printing.ipynb +++ b/Nextcloud_Material/create_oar_ID_csv_for_printing.ipynb @@ -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": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Ruder-IDlabel
0S-C2-M-19XX-01-BS-C2-M-19XX-01
1S-C2-M-19XX-01-SS-C2-M-19XX-01
2S-Sw-M-201X-01-BS-Sw-M-201X-01
3S-Sw-M-201X-01-SS-Sw-M-201X-01
4S-Sw-M-201X-02-BS-Sw-M-201X-02
.........
125R-C2-H-201X-08-B-skR-C2-H-201X-08-B
126R-C2-H-201X-09-S-skR-C2-H-201X-09-S
127R-C2-H-201X-10-B-skR-C2-H-201X-10-B
128R-C2-H-201X-11-S-skR-C2-H-201X-11-S
129R-C2-H-201X-12-B-skR-C2-H-201X-12-B
\n", + "

130 rows × 2 columns

\n", + "
" + ], + "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, diff --git a/Nextcloud_Material/enrich_oar_df_with_places_info.ipynb b/Nextcloud_Material/enrich_oar_df_with_places_info.ipynb new file mode 100644 index 0000000..255e0af --- /dev/null +++ b/Nextcloud_Material/enrich_oar_df_with_places_info.ipynb @@ -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": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
BootsnameTrimmungBootsplatzRuder-ID 1Ruder-ID 2
0Angie1x1S-Cr-M-200X-07-XS-C2-H-201X-16-X
1Architekten Lechner4x1S-C2-H-201X-01-XNaN
2Architekten Lechner4x2S-C2-H-201X-02-XNaN
3Architekten Lechner4x3S-C2-H-201X-03-XNaN
4Architekten Lechner4x4S-C2-H-201X-04-XNaN
..................
108Villacher Faschingsgilde2x1NaNNaN
109Villacher Faschingsgilde2x2NaNNaN
110Villacher Faschingsgilde2-1NaNNaN
111Villacher Faschingsgilde2-2NaNNaN
112Zernatto1x1NaNNaN
\n", + "

113 rows × 5 columns

\n", + "
" + ], + "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 +}