Hi, Stefan,
 
Thanks for your help.
 
First it is my typing error. My command 
is:fid=loadtxt('filename.csv',comments='"',dtype='|S4',converters={1:lambdas:int(s,16)},usecols=(1,))
 
It is not the zero. This will causes the same error as:
In [218]: fid=loadtxt('test.dat',comments='"',dtype='|S4',converters={1:lambda 
s:int(s,16)},usecols=(1,))---------------------------------------------------------------------------AttributeError
                            Traceback (most recent call last)
C:\DHG\DOCSIS\lab_test\parseadc.py in <module>()----> 1      2      3      4    
  5
C:\Python25\lib\site-packages\numpy\lib\io.pyc in loadtxt(fname, dtype, 
comments, delimiter, converters, skiprows, usecols, unpack)    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
 
This command is the same as yours. I do not know why it is working for you.> 
Date: Mon, 22 Sep 2008 22:13:18 +0200> From: [EMAIL PROTECTED]> To: 
numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] loadtxt error> > 
2008/9/22 frank wang <[EMAIL PROTECTED]>:> > 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,))> > You are specifying a converter that won't be in 
the output. I can fix> that, but in the meantime do:> > 
np.loadtxt('dat.dat',comments='"',dtype='|S4',converters={1:lambda> 
s:int(s,16)},usecols=(1,))> [(565,), (919,)]> |S4> > Regards> Stéfan> 
_______________________________________________> Numpy-discussion mailing list> 
Numpy-discussion@scipy.org> 
http://projects.scipy.org/mailman/listinfo/numpy-discussion
_________________________________________________________________
See how Windows connects the people, information, and fun that are part of your 
life.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to