Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to store PyTable columns in a specific order?
    primarykey
    data
    text
    <p>It seems that the PyTable columns are alphabetically ordered when using both dictionary or class for schema definition for the call to createTable(). My need is to establish a specific order and then use numpy.genfromtxt() to read and store my data from text. My text file does not have the variable names included alphabetically as they are for the PyTable.</p> <p>For example, assuming text file is named mydata.txt and is organized as follows:</p> <p>time(row1) bVar(row1) dVar(row1) aVar(row1) cVar(row1)</p> <p>time(row2) bVar(row2) dVar(row2) aVar(row2) cVar(row2) ...</p> <p>time(rowN) bVar(rowN) dVar(rowN) aVar(rowN) cVar(rowN)</p> <p>So, the desire is to create a table that is ordered with these columns and then use the numpy.genfromtxt command to populate the table.</p> <pre><code># Column and Table definition with desired order class parmDev(tables.IsDescription): time = tables.Float64Col() bVar = tables.Float64Col() dVar = tables.Float64Col() aVar = tables.Float64Col() cVar = tables.Float64Col() #... mytab = tables.createTable( group, tabName, paramDev ) data = numpy.genfromtxt(mydata.txt) mytab.append(data) </code></pre> <p>This is desired because it is straightforward code and is very fast. But, the PyTable columns are always ordered alphabetically and the appended data is ordered according to the desired order. Am I missing something basic here? Is there a way to have the order of the table columns follow the class definition order instead of being alphabetical?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload