Gideon Simpson wrote:
> I want to do:
>
> numpy.float(numpy.arange(0, 10))
>
> but get the error:
>
> Traceback (most recent call last):
>File "", line 1, in
> TypeError: only length-1 arrays can be converted to Python scalars
>
> How should I do this?
numpy.arange(0,10, dtype=float)
or
n
Gael Varoquaux wrote:
> nump.arange(0, 10.astype(numpy.float)
I think you meant:
np.arange(0, 10).astype(np.float)
but:
np.arange(0, 10, dtype=np.float)
is a better bet.
> but in this special case you can do:
>
> numpy.arange(0., 10.)
yup -- however, beware, using arange() with floating poi
On Thu, Feb 26, 2009 at 05:53:28PM -0500, Gideon Simpson wrote:
> I want to do:
> numpy.float(numpy.arange(0, 10))
> but get the error:
> Traceback (most recent call last):
>File "", line 1, in
> TypeError: only length-1 arrays can be converted to Python scalars
> How should I do this?
nu
I want to do:
numpy.float(numpy.arange(0, 10))
but get the error:
Traceback (most recent call last):
File "", line 1, in
TypeError: only length-1 arrays can be converted to Python scalars
How should I do this?
-gideon
___
Numpy-discussion mailin