Question

I'm trying to pass the values that I want numpy.arange to use.

The code is:

for x in numpy.arange(argument)

where argument is:

argument = (.1,6.3,.1) (tuple)

TypeError: arange: scaler arguements expected instead of a tuple

arguement = [.1,6.3,.1] (list)

TypeError: unsupported operand type(s) for -: 'str' and 'int'

arguement = '.1,6.3,.1' (string)

TypeError: unsupported operand type(s) for -: 'str' and 'int'

and I've tried putting the tuple and list in a string. None of these have worked.

I've searched the literature and can find no reference to this.

Any insights would be appreciated.

Was it helpful?

Solution

arange is like python's range function.

Perhaps you were looking for numpy.array?

Or maybe you really did want the range to be from 0.1 to 6.3 in steps of 0.1. In that case, use Python's argument unpacking syntax:

arguments = (.1, 6.3, .1)
numpy.arange(*arguments)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top