[Numpy-discussion] loadtxt error

frank wang f.yw@hotmail....
Mon Sep 22 14:19:16 CDT 2008

Hi, All,
I am struggling to make the loadtxt works. In my file, I have several colunms of data, say I have two. When I use the following command to load the data, 
fid=loadtxt('filename.csv',comments='"',dtype='|S4',converters={0:lambda s:int(s,16)})
It will load an array has two columns. However, I only want to load one column to save the memory. If I type
fid=loadtxt('filename.csv',comments='"',dtype='|S4',converters={0:lambda s:int(s,16)},usecols=(1,))
I got error:
    337     for i, conv in (user_converters or {}).iteritems():    338         if usecols:--> 339             i = usecols.find(i)    340         converters[i] = conv    341
AttributeError: 'tuple' object has no attribute 'find'> c:\python25\lib\site-packages\numpy\lib\io.py(339)loadtxt()    338         if usecols:--> 339             i = usecols.find(i)    340         converters[i] = conv
Can someone help to solve this problem? Or is this a bug in loadtxt?
Here is a test file with contains:
"ADCOUT" "Nyquist"29F 23529F 397
See how Windows Mobile brings your life together—at home, work, or on the go.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080922/e5b663fb/attachment.html 

More information about the Numpy-discussion mailing list