csv plotten - für jeden Tag eine separate Kennlinie

mit matplotlib, NumPy, pandas, SciPy, SymPy und weiteren mathematischen Programmbibliotheken.
Antworten
hawiwo
User
Beiträge: 6
Registriert: Dienstag 16. Juni 2020, 19:17

Hallo,
ich habe ein CSV-Tabelle im Format

created_at,entry_id,field1
2022-07-18 23:30:52 UTC,88590,43.224765

mit den Modulen Pandas und matplotlib.pyplot kann ich daraus eine Kennlinie darstellen.

Jetzt will die Daten in einem Plot überlagern, so dass für jeden Tag eine neue bei X=0 beginnende
Kennlinie angezeigt wird.
Hat jemand eine Idee, wie das umgesetzt werden könnte bzw. ein Beispiel?

Code: Alles auswählen

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pandas import Series, DataFrame

open('1.csv', 'wb')

data = pd.read_csv('1.csv')
fig, ax = plt.subplots(figsize=(12,6))

ax.plot(data['field1'])
ax.set_xticks(np.arange(0,150,5))
ax.set_yticks(np.arange(41,44,0.1))
ax.grid(True)
plt.show()

Benutzeravatar
__blackjack__
User
Beiträge: 13117
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

@hawiwo: Man könnte die Tage mit `groupby()` gruppieren und dann plotten.
„All religions are the same: religion is basically guilt, with different holidays.” — Cathy Ladman
hawiwo
User
Beiträge: 6
Registriert: Dienstag 16. Juni 2020, 19:17

Top. Das hilft weiter!
Antworten