Manuel Wittchen
2010-01-02 10:23:13 UTC
Hi,
I want to calculate the difference between the values of a
numpy-array. The formula is:
deltaT = t_(n+1) - t_(n)
My approach to calculate the difference looks like this:
for i in len(ARRAY):
delta_t[i] = ARRAY[(i+1):] - ARRAY[:(len(ARRAY)-1)]
print "result:", delta_t
But I get a TypeError:
File "./test.py", line 19, in <module>
for i in len(ARRAY):
TypeError: 'int' object is not iterable
Where is the mistake in the code?
Regards and a happy new year,
Manuel Wittchen
I want to calculate the difference between the values of a
numpy-array. The formula is:
deltaT = t_(n+1) - t_(n)
My approach to calculate the difference looks like this:
for i in len(ARRAY):
delta_t[i] = ARRAY[(i+1):] - ARRAY[:(len(ARRAY)-1)]
print "result:", delta_t
But I get a TypeError:
File "./test.py", line 19, in <module>
for i in len(ARRAY):
TypeError: 'int' object is not iterable
Where is the mistake in the code?
Regards and a happy new year,
Manuel Wittchen