[Numpy-discussion] loadtxt error

Stéfan van der Walt stefan@sun.ac...
Mon Sep 22 15:13:18 CDT 2008


2008/9/22 frank wang <f.yw@hotmail.com>:
> 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


More information about the Numpy-discussion mailing list