python "TypeError: 'numpy.float64' object cannot be interpreted as an integer"

The Solution to python "TypeError: 'numpy.float64' object cannot be interpreted as an integer" is


N=np.floor(np.divide(l,delta))
...
for j in range(N[i]/2):

N[i]/2 will be a float64 but range() expects an integer. Just cast the call to

for j in range(int(N[i]/2)):

~ Answered on 2014-06-02 21:18:36


Most Viewed Questions: