Reputation: 135
I am collecting the data from some source in multiple dictionaries like below
d1={'01-01-2018':15,'02-01-2018':15,'03-01-2018':15}
d1={'01-01-2018':20,'02-01-2018':25,'03-01-2018':56}
d1={'01-01-2018':10,'02-01-2018':14,'03-01-2018':45}
d1={'01-01-2018':18,'02-01-2018':15,'03-01-2018':15}
Every dictionary is having Date and Values.Now I want to convert them into dataframe and then plot in a single linear graph (with 4 lines for d1,d2,d3,d4
, x axis
- Date, y axis
- Value)
If multiple dictionaries are not convenient for plotting in a single graph, I can collect then in other suitable data structure (List)
Upvotes: 1
Views: 1509
Reputation: 214937
df = pd.DataFrame({'d1': d1, 'd2': d2, 'd3': d3, 'd4': d4})
df.reindex(pd.to_datetime(df.index)).plot()
Upvotes: 3