-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
33 lines (25 loc) · 801 Bytes
/
plot.py
File metadata and controls
33 lines (25 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
# CSV laden
df = pd.read_csv("daily_energy.csv", sep=";")
# Datum konvertieren
df["date"] = pd.to_datetime(df["date"])
# Letzte Messung auf 2026-03-14 verschieben
target_date = pd.Timestamp.today()
target_date_str = target_date.strftime("%Y-%m-%d")
delta = target_date - df["date"].max() # Delta berechnen
df["date"] = df["date"] + delta # Delta zu allen Daten hinzuf�gen
# Sortieren
df = df.sort_values("date")
# Balkendiagramm
plt.figure(figsize=(10,5))
plt.bar(df["date"], df["energy_kWh"])
# Beschriftung
plt.xlabel("Date")
plt.ylabel("Energy (kWh)")
plt.title(f"Daily Energy Production shifted by delta to {target_date_str}")
# Datum lesbar machen
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()