2010/8/14, Vineet Jain <vinjv...@gmail.com>: > dsttable = mapping2.tblData > dr = dsttable.row > #save symbol mapping > for row in mapping.tblData.iterrows(): > dr[0], dr[1], dr[2], dr[3] = row[0], row[1], int(row[2]), row[3] > dr.append() > dsttable.flush() > > > Gives the following exception: > > dr[0], dr[1], dr[2], dr[3] = row[0], row[1], int(row[2]), row[3] > File "tableExtension.pyx", line 1423, in > tables.tableExtension.Row.__setitem__ > File "tableExtension.pyx", line 131, in > tables.tableExtension.getNestedFieldCache > KeyError: 0
Yes, the problem of not trying code out before sending it :-/. We should pass field *names* and not indices to the Row accessor. Try this instead: dsttable = mapping2.tblData dr = dsttable.row #save symbol mapping for row in mapping.tblData.iterrows(): dr['fullSymbol'] = row['fullSymbol'] dr['calcField'] = row['calcField'] dr['hhmmss'] = int(row['hhmmss']) dr['value'] = row['value'] dr.append() dsttable.flush() -- Francesc Alted ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users