'Plotting multiple store sales into 1 plot

I have problem plotting multiple timeseries into 1 plot. My dataframe looks like this:
enter image description here
So I want all 10 stores plotted into 1 plot, such that all stores have different colours, with the end product looking like this:
enter image description here
So far I've tried with the foloowing code, but it does not work:

store_daily_sales = train.groupby(['store', 'date'], as_index=False)['sales'].sum()
plt.figure(figsize=(12,8), dpi = 150)
plt.plot(store_daily_sales)
plt.title = ('Daily sales') 
plt.xlabel('Date')
plt.ylabel('sales')
plt.show()

Can anybody help?



Solution 1:[1]

I think you're best off reformatting a bit first and then plotting. Hopefully this does the trick:

reformat = pd.pivot(train,values='sales',index='date',columns='store')
reformat.plot()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1