I am self taught and very retarded.
Is there anything in my code that would tell you this right away?
import numpy as np, openpyxl, matplotlib.pyplot as plt
def getdatafor(*args):
results = []
for country in args:
#Opens worksheet by country
#pulls the active sheet
xldata = (openpyxl.load_workbook('C:\\Users\\Shepard\\Documents\\data\\macro_data\\{}.xlsx'.format(country)))
xlsheet = xldata.get_active_sheet()
#Country data index [0:13] [Year Population Y/Pop Y/Pop(us=100) Y/Wkr Y/Wkr(us=100) growth*100 I/Y G/Y Ed.Att. NX/Y X+M/Y ExRate]
x = np.array([[float(i.value) for i in j[11:76]]for j in xlsheet.columns])
finish = [x,country.upper()]
results.append(finish)
xldata.close()
return results
def graph(list_of_countries,index_number):
generic_X = np.array([i for i in range(1950,2015)])
country_names = []
#adds each line sepperately to graph
for country in list_of_countries:
plt.plot(generic_X,country[0][index_number])
country_names.append(country[1])
#generates appropriate title,label,legend,ticks for graph:
labels = ['Year' ,'Population', 'Y/Pop', 'Y/Pop(us=100)', 'Y/Wkr', 'Y/Wkr(us=100)', 'growth*100', 'I/Y', 'G/Y', 'Ed.Att.', 'NX/Y', 'X+M/Y', 'ExRate']
plt.xlim(1950, 2015)
plt.ylabel(labels[index_number])
plt.xlabel(labels[0])
title = labels[index_number]+ ' for '+' '.join(country_names) + ' 1950-2014'
plt.title(title)
plt.legend(country_names)
plt.show()
#example command:
#gd.graph(gd.getdatafor('usa','dnk'),10)
I never have anyone critic my work so and feedback at all would be great!