Skip to content
Snippets Groups Projects
Commit f1acf2dc authored by root's avatar root
Browse files

Added Example 08 Water Height Diagram

parent c48d0bd5
No related branches found
No related tags found
No related merge requests found
import pandas as pd
import matplotlib.pyplot as plt
# Lese die csv Datei und interpretiere ';' als Trennzeichen und ',' als decimalzeichen und erstelle keinen Index
df = pd.read_csv("pegel.csv", sep=';', decimal=',', index_col=False)
# Wähle nur die Zeit und wasserstand Spalten aus und ignoriere die anderen Spalten
df = df[["Zeit", "wasserstand"]]
# Interpretiere die Zeit als datetime Objekte und die Wasserstände als Zahlen
df["Zeit"] = pd.to_datetime(df["Zeit"])
df["wasserstand"] = pd.to_numeric(df["wasserstand"])
# Filtere die Daten nach dem gewünschten Jahr. Zum Beispiel 2023
df = df[df.Zeit.dt.year.eq(2023)]
# Plotte die Daten
plt.plot(df["Zeit"], df["wasserstand"])
# Schreibe die Zeiten schräg unter die x Achse
plt.gcf().autofmt_xdate()
# Speichere es als png
plt.savefig("output.png")
08_WaterHeightDiagram/output.png

37.2 KiB

Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -9,3 +9,4 @@ Example # | Name | Description | Input format | Output | Source
04 | Water measuring stations | Display all water level measuring stations in Schleswig-Holstein using the folium library with OpenStreetMap | CSV | OpenStreetMap overlay | https://opendata.schleswig-holstein.de/dataset/pegel-stammdaten
05 | Park bench map | Show a map of all park benches in the city of Norderstedt | SHP (shape file) | Table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/parkbanke
06 | Tax office map | Create a formatted HTML and map containing all tax offices in Schleswig-Holstein | RDF | HTML table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/finanzamter-2024-01-28
08 | Water height diagram | Create a line diagram of the water height of the Stoer near Willenscharen for 2023 | CSV | Diagram (PNG) | https://opendata.schleswig-holstein.de/dataset/wasserstand-pegel-willenscharen-stor1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment