0
votes

I apologize in advance, I saw the answers already given for a similar kind of error but I couldn't make out anything out of it for my case. My python is quite basic and I am trying run that 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:

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

Is there a way to use a float in a range like that?

Thanks,

1
Not completely sure what you're trying to do, but if you really need to use floats there have a look at Numpy's arange(): docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html - mechanical_meat
range is only going to yield integers anyways so just call int() on your parameters before passing them in. - gps

1 Answers

3
votes

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

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