previousTable of ContentsReferencesnext
Appendix

Appendix A: Supported data types in PyTables

The Table, Array, VLArray and EArray classes can all handle the complete set of data types supported by the numarray package (see ) and Numeric (see ) in Python. The data types for table fields can be set via the constructor for the Col class and its descendants (see 4.13.2) while array elements can be set through the use of the Atom class and its descendants (see 4.13.3).

In addition to those data types, PyTables' Table, VLArray and EArray classes do support some aliasing data types for their columns and atoms. Each one of these aliasing types corresponds to one numarray type, but they also have special meanings for PyTables. They can be seen as the ordinary types they are associated with, plus some additional meaning. Since they do not exist as numarray types, they can only be specified to PyTables using strings.

Currently, the only supported aliasing data type is Time. Two kinds of time values can be handled: 4-byte signed integer and 8-byte double precision floating point. Both of them reflect the number of seconds since the Unix Epoch, i.e. Jan 1 00:00:00 UTC 1970. Their types correspond to numarray's Int32 and Float64, respectively. Time values are stored in the HDF5 file using the H5T_TIME class. Integer times are stored as is, while floating point times are split into two signed integer values representing seconds and microseconds (beware: smaller decimals will be lost!).

A quick reference to the complete set of data types supported by PyTables is given in table A.

Table A.1: Data types supported for array elements and tables columns in PyTables.
Type CodeDescriptionC TypeSize (in bytes)Python Counterpart
Boolbooleanunsigned char1Boolean
Int88-bit integersigned char1Integer
UInt88-bit unsigned integerunsigned char1Integer
Int1616-bit integershort2Integer
UInt1616-bit unsigned integerunsigned short2Integer
Int32integerint4Integer
UInt32unsigned integerunsigned int4Long
Int6464-bit integerlong long8Long
UInt64unsigned 64-bit integerunsigned long long8Long
Float32single-precision floatfloat4Float
Float64double-precision floatdouble8Float
Complex32single-precision complexstruct {float r, i;}8Complex
Complex64double-precision complexstruct {double r, i;}16Complex
CharTypearbitrary length stringchar[]*String
'Time32'integer timePOSIX's time_t4Integer
'Time64'floating point timePOSIX's struct timeval8Float

previousTable of ContentsReferencesnext