18 Jul
2012
18 Jul
'12
1:18 p.m.
On Wed, 2012-07-18 at 15:14 +0200, Molinaro CĂ©line wrote:
In [2]: numpy.real(arange(3)) Out[2]: array([0, 1, 2]) In [3]: numpy.complex(arange(3)) TypeError: only length-1 arrays can be converted to Python scalars
Are there any reasons why numpy.complex doesn't work on arrays? Should it be bug reported?
numpy.complex is just a reference to the built in complex, so only works on scalars: In [5]: numpy.complex is complex Out[5]: True Try numpy.complex128 (or another numpy.complexN, with N being the bit length). Henry