numpy.linspace() gives you a one-dimensional NumPy array. For instance:
>>> my_array = numpy.linspace(1, 10, 10) >>> my_array array([ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.])
In this way:
for index,point in my_array
can't work. You will need some kind of two-dimensional array with two elements in the second dimension:
>>> two_d = numpy.array([[1, 2], [4, 5]]) >>> two_d array([[1, 2], [4, 5]])
Now you can do this:
>>> for x, y in two_d: print(x, y) 1 2 4 5
source share