Add python script to export data from excel

This commit is contained in:
Niklas Meinzer
2024-11-19 08:13:32 +01:00
parent 02d5c5f1ca
commit 321a11367e
3 changed files with 31 additions and 0 deletions

23
prepareFlatData.py Normal file
View File

@@ -0,0 +1,23 @@
from pandas import read_excel
import json
PATH = "/home/niklas/Nextcloud_Allmende/wohpro/04_AGs/04_AG_Finanzen/Finanzierungsplan MHS/2024-11-05_FP_Allmende_Umschuldung_Angebot Nachfinanzierung_Szenarien_Solimieten.xlsx"
OUTPUT_PATH = "./rent_data.json"
if __name__ == "__main__":
df = read_excel(PATH, sheet_name="Solimieten Daten Onlinetool")
data = {}
for index, row in df.iterrows():
data[row["Wohneinheit"]] = {
"size_private": row["Zahlfläche privat (m²)"],
"size_shared": row["Zahlfläche intern"],
"min_rent": row["Mindestmiete"],
"free_rent": row["Standardmiete frei"],
"wbs_rent": row["Standardmiete WBS"],
}
with open(OUTPUT_PATH, "w") as f:
json.dump(data, f)

7
pyproject.toml Normal file
View File

@@ -0,0 +1,7 @@
[project]
name = "allmende_solimieten"
version = "0.1.0"
dependencies = [
"pandas[excel]",
]
requires-python = ">=3.12"

1
src/rent_data.json Normal file

File diff suppressed because one or more lines are too long