Python TypeError: range () integer final argument expected to receive a float

I apologize in advance, I saw the answers already given for a similar error, but I could not do any of this for my case. My python is pretty simple and I'm trying to run this little piece of code:

mybox = (17.0, -13.0, 489.0644700903291, 566.0) # this 'box' is my input so these values will vary xMin, yMin, xMax, yMax = mybox yValue = range(yMin, yMax, 30) 

running it, I get an error message:

 TypeError: range() integer end argument expected, got float. 

Is there any way to use float in this range?

Thanks,

0
source share
1 answer

You are looking for arange, which can be found in numpy (or pylab).

 import numpy ... yValue = numpy.arange(yMin, yMax, 30.0) 
+4
source

Source: https://habr.com/ru/post/1212764/


All Articles