Gideon Simpson wrote:
> I want to do:
> 
> numpy.float(numpy.arange(0, 10))
> 
> but get the error:
> 
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> TypeError: only length-1 arrays can be converted to Python scalars
> 
> How should I do this?

numpy.arange(0,10, dtype=float)
or
numpy.arange(0.0, 10.0)

The first is nice because it is very explicit, and it works when the 
limits may be variables of any numeric type.

Eric

> 
> -gideon
> 
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to