views:

37

answers:

0

The following code provides my needed functionality; but, takes a bit more than 10 seconds for a table that includes 200 variables with 64000 rows. Is there a more efficient way to create a variable namespace that matches the 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 within an analysis environment and represents a large proportion of the wait time for the end user; so, I would like confirmation that this is the best way to achieve the establishment of a namespace dynamically based upon the PyTable column names.