I am trying to plot my data in the csv file. Currently my dates are not shown properly in the plot also if i am converting it. How can I change it to show the proper dat format as defined Y-m-d? The second question is that I am currently plotting all the dat in one plot but want to have for every Valuegroup one subplot.
My code looks like the following:
import pandas as pd
import matplotlib.pyplot as plt
csv_loader = pd.read_csv('C:/Test.csv', encoding='cp1252', sep=';', index_col=0).dropna()
csv_loader['Date'] = pd.to_datetime(csv_loader['Date'], format="%Y-%m-%d")
print(csv_loader)
fig, ax = plt.subplots()
csv_loader.groupby('Valuegroup').plot(x='Date', y='Value', ax=ax, legend=False, kind='line')
plt.grid(True)
The csv file looks like the following:
Calcgroup;Valuegroup;id;Date;Value Group1;A;1;20080103;0.1 Group1;A;1;20080104;0.3 Group1;A;1;20080107;0.5 Group1;A;1;20080108;0.9 Group1;B;1;20080103;0.5 Group1;B;1;20080104;1.3 Group1;B;1;20080107;2.0 Group1;B;1;20080108;0.15 Group1;C;1;20080103;1.9 Group1;C;1;20080104;2.1 Group1;C;1;20080107;2.9 Group1;C;1;20080108;0.45