This gives the expected result
x = random.rand(1) + random.rand(1)*1j print x.dtype print x, x.real, x.imag
and this works
I used astype to change the type to complex and it worked in my case (Python 3), although I am not sure whether it is the best way. One example:
import numpy as np c2 = np.empty([2,2]).astype(complex) c2[0] = 5j+2