[SciPy-user] [newb] how to create arrays

Robert Kern robert.kern at gmail.com
Thu Jan 3 15:09:38 EST 2008


Neal Becker wrote:
>>> Robert Kern wrote:

>>>>   from numpy import *
>>>>
>>>>   z = empty([10], dtype=complex)
>>>>   z.real[:] = random.standard_normal(10)
>>>>   z.imag[:] = random.standard_normal(10)
> 
> It seems this also works?
> z = empty([10], dtype=complex)
> z.real = random.standard_normal(10)
> z.imag = random.standard_normal(10)

Yes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list