adapted some code for new folder structure
wrote the enrichment_code for oar_id and boat_places
This commit is contained in:
@@ -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')"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user