data2 = data.drop('Indicator Name', axis=1, inplace=True)
data3 = data2.drop('Indicator Code', axis=1, inplace=True)
x = [ data3[x].mean() for x in data.loc[:, "1960" : "2017" ]]
y = data.loc[:, "1960" : "2017" ]
plt.plot(x, y, color='orange')
plt.title('GDP Per year form 1960 to 2017')
plt.show()
I want to plot the mean value of all the data from 1960 to 2017 but I'm getting an error when I try to get the mean values for each column to use them in the plot. What is the best approach to achieve that. Need help
TypeError Traceback (most recent call last)
<ipython-input-63-ec5963e0529b> in <module>()
1 data2 = data.drop('Indicator Name', axis=1, inplace=True)
2 data3 = data.drop('Indicator Code', axis=1, inplace=True)
----> 3 x = [ data2[x].mean() for x in data.loc[:, "1960" : "2017" ]]
4 y = data.loc[:, "1960" : "2017" ]
5 plt.plot(x, y, color='orange')
<ipython-input-63-ec5963e0529b> in <listcomp>(.0)
1 data2 = data.drop('Indicator Name', axis=1, inplace=True)
2 data3 = data.drop('Indicator Code', axis=1, inplace=True)
----> 3 x = [ data2[x].mean() for x in data.loc[:, "1960" : "2017" ]]
4 y = data.loc[:, "1960" : "2017" ]
5 plt.plot(x, y, color='orange')
TypeError: 'NoneType' object is not subscriptable