Tutorial_01_task_1_solution
In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
spend_years_raw = pd.read_excel(“AmountSpent_13to17.xlsx”)
spend_years=spend_years_raw.iloc[:,1:] #To remove the first indexing column
spend_years.head()
Out[1]:
2013 2014 2015 2016 2017
0 3006 245 730 1339 755
1 1445 804 1183 1256 1318
2 2393 592 8 1625 296
3 3773 121 2572 2874 2436
4 294 42 2113 2413 1304
In [2]:
plt.plot([1,2,3,4,5], spend_years.mean())
plt.xticks( np.arange(1,6), [‘2013’, ‘2014’, ‘2015’, ‘2016’, ‘2017’] )
plt.xlabel(“Year”)
plt.ylabel(“Average Customer Spend”)
plt.title(“Historical Average Customer Spending”)
fig = plt.figure()