[Numpy-discussion] correct way to specify type in array definition

Brian Blais bblais@bryant....
Thu Mar 15 05:01:34 CDT 2007


Hello,

Can someone tell me what the preferred way to specify the type of an array?  I want
it to be a float array, no matter what is given (say, integers).  I can do:

a=numpy.array([1,2,3],numpy.dtype('float'))

or

a=numpy.array([1,2,3],type(1.0))

or perhaps many others.  Is there a way that is recommended?


			thanks,


				Brian Blais


-- 
-----------------

              bblais@bryant.edu
              http://web.bryant.edu/~bblais



More information about the Numpy-discussion mailing list