|
From: Francesc A. <fa...@ca...> - 2006-01-17 16:20:13
|
Hi,
When building recarrays in numpy following the numarray convention:
In [2]: numpy.zeros((3,), dtype=3D'u1')
Out[2]: array([0, 0, 0], dtype=3Duint8)
In [3]: numpy.zeros((3,), dtype=3D'u1,f4')
Out[3]: array([(0, 0.0), (0, 0.0), (0, 0.0)], dtype=3D(void,5))
In [4]: numpy.zeros((3,), dtype=3D'2u1,f4')
Out[4]:
array([(array([0, 0], dtype=3Duint8), 0.0),
(array([0, 0], dtype=3Duint8), 0.0), (array([0, 0], dtype=3Duint8), =
0.0)],=20
dtype=3D(void,6))
In [7]: numpy.zeros((3,), dtype=3D'(2,)u1,f4')
Out[7]:
array([(array([0, 0], dtype=3Duint8), 0.0),
(array([0, 0], dtype=3Duint8), 0.0), (array([0, 0], dtype=3Duint8), =
0.0)],=20
dtype=3D(void,6))
So far so good, but
In [5]: numpy.zeros((3,), dtype=3D'2u1')
=2D------------------------------------------------------------------------=
=2D-
exceptions.TypeError Traceback (most recent=
=20
call last)
/home/faltet/python.nobackup/numpy/<ipython console>
TypeError: data type not understood
Also:
In [6]: numpy.zeros((3,), dtype=3D'(2,)u1')
=2D------------------------------------------------------------------------=
=2D-
exceptions.ValueError Traceback (most recent=
=20
call last)
/home/faltet/python.nobackup/numpy/<ipython console>
/usr/lib/python2.4/site-packages/numpy/core/_internal.py in _commastring(as=
tr)
296 res =3D _split(astr)
297 if (len(res)) =3D=3D 1:
=2D-> 298 raise ValueError, "no commas present"
299 result =3D []
300 for k,item in enumerate(res):
ValueError: no commas present
Perhaps this is the same case as defining tables with just one column?
=2D-=20
>0,0< Francesc Altet =A0 =A0 http://www.carabos.com/
V V C=E1rabos Coop. V. =A0=A0Enjoy Data
"-"
|