[Numpy-discussion] dtype=float32 not recognised.

Sasha ndarray at mac.com
Tue Jan 24 16:57:05 EST 2006


You did not import float32.

Your options:

>>> from numpy import *
>>> zeros(5, dtype=float32)
array([ 0.,  0.,  0.,  0.,  0.], dtype=float32)

or

>>> import numpy
>>> numpy.zeros(5, dtype=numpy.float32)
array([ 0.,  0.,  0.,  0.,  0.], dtype=float32)

or

>>> import numpy
>>> numpy.zeros(5, dtype=float)
array([ 0.,  0.,  0.,  0.,  0.])

-- sasha

On 1/24/06, agn at noc.soton.ac.uk <agn at noc.soton.ac.uk> wrote:
> A curious problem (0.9.5.1993):
>
> n [12]: theta3 =numpy.zeros(66,dtype=float32)
> ---------------------------------------------------------------------------
> exceptions.NameError                                 Traceback (most recent call
> last)
>
> /working/jrd/mod2/agn/OCCAM/AGN_GLOBAL/<ipython console>
>
> NameError: name 'float32' is not defined
>
> But
> n [14]: theta3 =numpy.zeros(66,dtype='f')
>
> In [15]: theta3
> Out[15]:
> array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
>         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
>         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
>         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
>         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
> dtype=float32)
>
> George Nuresr
>
>
> -----------------------------------------------------------------------
> National Oceanography Centre, Southampton :: http://www.noc.soton.ac.uk
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>




More information about the NumPy-Discussion mailing list