2010/8/14, Vineet Jain <vinjv...@gmail.com>:
>>            r = list(row)  # convert row into a list
>>            r[2] = int(r[2])
>>            r = tuple(r)   # convert again into a tuple
>
> This does not work. Got an error that int is expecting int,str
>
> I modified it to:
>
> for i, row in enumerate(mapping.tblData.iterrows()):
>         dsttable.append([(row[0], row[1], int(row[2]), row[3])]) #
> append converted row to dsttable

Ah, correct.  Yes, your version is fine.

> But it is much slower than the original way

Indeed, this is expected, but it does not consume lots of memory
resources.  Mmh, probably the next:

dr = dsttable.row
for row in mapping.tblData.iterrows():
        dr[0], dr[1], dr[2], dr[3] = row[0], int(row[1]), row[2], row[3]
        dr.append()
dsttable.flush()

is faster, but you should try it just to be sure.

-- 
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

Reply via email to