The most efficient way to retrieve PyTables tables with stored code names as variable names

The following code provides my necessary functions; but for a table that includes 200 variables with 64,000 rows, it takes a little over 10 seconds. Is there a more efficient way to create a variable namespace that matches column names?

strExec = "a = table[:]"  
for colobj in table.description._f_walk(type="Col"):  
    colName = colobj._v_pathname  
    strExec = strExec + '\n' + colName + " = a['" + colName + "']"  
exec(strExec)  

The code will be executed in the analysis environment and will represent most of the waiting time for the end user; therefore, I would like to confirm that this is the best way to achieve dynamically creating a namespace based on PyTable column names.

+3
source share
1 answer

unutbu, copy a = table [:] . tablename . , , .

+1

Source: https://habr.com/ru/post/1765854/


All Articles