Hi All, I am using pytables to store data in hdf5 format. Each table in the hdf5 file has many user defined attributes.
For example: Suppose the table name is: thistab It has user defined attributes some of which are floats, some are ints and some are strings. For the float (and int) attributes, the following works: datatype = {"names": ["Floatattr1", "Floatattr2"], "formats": [type(tab.attrs.__getattr__("Floatattr1")), type(tab.attrs.__getattr__("Floatattr2")) ]} nparray = np.zeros(10, dtype = datatype) However, if I try the same for the String attribute it does not work. If I try the following: datatype = {"names": ["Stringattr1", "Floatattr2"], "formats": [type(tab.attrs.__getattr__("Floatattr1")), type(tab.attrs.__getattr__("Floatattr2")) ]} nparray = np.zeros(10, dtype = datatype) I get TypeError: data type not understood Any suggestions for how I can make this work - I want to specify the numpy array datatype by reading the type from table attributes. Thanks in advance for your help. ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users