In [1]:
# imports and load data
import pandas as pd
% matplotlib inline

df = pd.read_csv('store_data.csv')
df.head()
Out[1]:
week storeA storeB storeC storeD storeE
0 2014-05-04 2643 8257 3893 6231 1294
1 2014-05-11 6444 5736 5634 7092 2907
2 2014-05-18 9646 2552 4253 5447 4736
3 2014-05-25 5960 10740 8264 6063 949
4 2014-06-01 7412 7374 3208 3985 3023
In [2]:
# explore data
df.tail(20)
Out[2]:
week storeA storeB storeC storeD storeE
180 2017-10-15 8556 11984 4792 5995 2508
181 2017-10-22 3751 697 3990 4236 360
182 2017-10-29 4997 9759 4290 4568 2393
183 2017-11-05 12785 1800 6163 5157 578
184 2017-11-12 137 12261 5455 7695 2599
185 2017-11-19 9960 8529 4501 7631 505
186 2017-11-26 6866 5011 5401 4736 3232
187 2017-12-03 5179 3850 6121 6778 113
188 2017-12-10 9348 5624 5446 5448 227
189 2017-12-17 5310 8647 5680 7049 3578
190 2017-12-24 8976 9503 6240 3882 2890
191 2017-12-31 11875 1527 6711 5265 1701
192 2018-01-07 8978 11312 4158 5019 3842
193 2018-01-14 6963 4014 4215 7153 3097
194 2018-01-21 5553 3971 3761 6255 3071
195 2018-01-28 282 6351 7759 5558 1028
196 2018-02-04 4853 6503 4187 5956 1458
197 2018-02-11 9202 3677 4540 6186 243
198 2018-02-18 3512 7511 4151 5596 3501
199 2018-02-25 7560 6904 3569 5045 2585
In [3]:
# sales for the last month
df.iloc[196:, 1:].sum().plot(kind='bar');
In [4]:
# average sales
df.mean().plot(kind='pie');
In [5]:
# sales for the week of March 13th, 2016
sales = df[df['week'] == '2016-03-13']
sales.iloc[0, 1:].plot(kind='bar');
In [6]:
# sales for the lastest 3-month periods
last_three_months = df[df['week'] >= '2017-12-01']
last_three_months.iloc[:, 1:].sum().plot(kind='pie')
Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f86810015c0>