Table IO - emer/etable GitHub Wiki
Tables will read / write standard CSV (comma-separated values) and TSV (tab..)
To capture the type and shape of the columns, we support the standard header formatting from C++ emergent -- we weren't able to find any more widely supported standard (please let us know if there is one that we've missed -- easy to support!)
Here is the mapping of special header prefix characters to standard types:
'$': etensor.STRING,
'%': etensor.FLOAT32,
'#': etensor.FLOAT64,
'|': etensor.INT64,
'@': etensor.UINT8,
'&': etensor.STRING,
'^': etensor.BOOl,
Columns that have tensor cell shapes (not just scalars) are marked as such with the first such column having a <ndim:dim,dim..>
suffix indicating the shape of the cells in this column, e.g., <2:5,4>
indicates a 2D cell Y=5,X=4. Each individual column is then indexed as [ndims:x,y..]
e.g., the first would be [2:0,0]
, then [2:0,1]
etc.
Here's a TSV file for a scalar String column (Name
), a 2D 1x4 tensor float32 column (Input
), and a 2D 1x2 float32 Output
column.
_H: $Name %Input[2:0,0]<2:1,4> %Input[2:0,1] %Input[2:0,2] %Input[2:0,3] %Output[2:0,0]<2:1,2> %Output[2:0,1]
_D: Event_0 1 0 0 0 1 0
_D: Event_1 0 1 0 0 1 0
_D: Event_2 0 0 1 0 0 1
_D: Event_3 0 0 0 1 0 1