I have a dictionary dgr of n (for this example let's just say n=10) objects named 'gr0' up to 'gr(n-1)' (in case n=10 up to 'gr9') with float values ordered to them in the following fashion:
dgr = {'gr0': 1.3, 'gr1': 1.2, 'gr2': 1.9, 'gr3': 2.4, 'gr4': 2.2, 'gr5': 4.2, 'gr6': 1.2, 'gr7': 5.5, 'gr8': 4.3, 'gr9': 3.2}
I have another dictionary
dy = {}
which is supposed to be filled as such (the 2nd line produces the to-be-fixed error):
for x in range(0,n):
dy["y{0}".format(x)] = sum(dgr.values()[0,x])
so 'y0' is 1.3, but 'y3' is 6.8 so the sum of the values of 'gr0' up to 'gr3'.
Summing all values of gr{x}' (so leaving [0,x] out) works but if I try to do the partial sums with [0,x] it gives me this error:
'dict_values' object is not subscriptable