
Hi, The following did once work in NumPy:
dtype([int16]) dtype([[int16]]) dtype([uint,int32]) dtype(['f8','S10'])
but now they all generate a "TypeError: data type not understood". Why? I could not find the answer in help(dtype), the RecordArrays tutorial on scipy.org, the NumPy release notes, nor in the NumPy book. J. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Joris De Ridder wrote:
Hi,
The following did once work in NumPy:
dtype([int16]) dtype([[int16]]) dtype([uint,int32]) dtype(['f8','S10'])
but now they all generate a "TypeError: data type not understood". Why? I could not find the answer in help(dtype), the RecordArrays tutorial on scipy.org, the NumPy release notes, nor in the NumPy book.
It's in the release notes. Look in the section from 1.0b2 to 1.0b3. It's highlighted with a Note: *NOTE: * When creating data-type objects from lists, the list must be in array descriptor format. The "list of data-type objects" approach is no longer supported due to its ambiguity with the very common array descriptor approach. You can still get this behavior using a comma-separated string or changing your list to an array_descriptor: [('', x) for x in oldlist] -Travis ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

A Divendres 27 Octubre 2006 18:13, Joris De Ridder va escriure:
Hi,
The following did once work in NumPy:
dtype([int16]) dtype([[int16]]) dtype([uint,int32]) dtype(['f8','S10'])
but now they all generate a "TypeError: data type not understood". Why?
Should be intended as well. If you try to set a dtype from a list, it has to follow the format of a description as specified in: http://numpy.scipy.org/array_interface.shtml for example: In [67]: dtype([('f1', int16)]) Out[67]: dtype([('f1', '<i2')]) In [68]: dtype([('f1', int16, (2,2))]) Out[68]: dtype([('f1', '<i2', (2, 2))]) In [69]: dtype([('f1', int16, (2,2)), ('f3', int32)]) Out[69]: dtype([('f1', '<i2', (2, 2)), ('f3', '<i4')]) Cheers, --
0,0< Francesc Altet http://www.carabos.com/ V V Cárabos Coop. V. Enjoy Data "-"
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

On Friday 27 October 2006 19:06, Francesc Altet wrote: [FA]: for example: [FA]: [FA]: In [67]: dtype([('f1', int16)]) [FA]: Out[67]: dtype([('f1', '<i2')]) [FA]: [FA]: In [68]: dtype([('f1', int16, (2,2))]) [FA]: Out[68]: dtype([('f1', '<i2', (2, 2))]) [FA]: [FA]: In [69]: dtype([('f1', int16, (2,2)), ('f3', int32)]) [FA]: Out[69]: dtype([('f1', '<i2', (2, 2)), ('f3', '<i4')]) Thanks, Francesc, for the examples! IMO, record arrays seem powerful, but also intimidating at a first glance. I think many didactical examples will help getting them into common use. I made some effort to get updated examples in the Numpy Example List: www.scipy.org/Numpy_Example_List#dtype www.scipy.org/Numpy_Example_List#array Could people who already have some experience with it, have a look at them and give me their opinion? Cheers, Joris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

El dl 30 de 10 del 2006 a les 14:58 +0100, en/na Joris De Ridder va escriure:
IMO, record arrays seem powerful, but also intimidating at a first glance.
Agreed, specially if you start to nest datatypes.
I think many didactical examples will help getting them into common use. I made some effort to get updated examples in the Numpy Example List:
www.scipy.org/Numpy_Example_List#dtype www.scipy.org/Numpy_Example_List#array
Could people who already have some experience with it, have a look at them and give me their opinion?
Looks good. I've taken the freedom to add some examples of nested types and recarrays. -- Francesc Altet | Be careful about using the following code -- Carabos Coop. V. | I've only proven that it works, www.carabos.com | I haven't tested it. -- Donald Knuth ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
participants (3)
-
Francesc Altet
-
Joris De Ridder
-
Travis Oliphant