csv blank fields

Mag Gam magawake at gmail.com
Sat Jun 27 09:33:09 EDT 2009


well, I am actually loading the row into a fixed width array

reader=csv.reader(fs)
for s,row in enumerate(reader):
  t=np.array([(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9],row[10])],dtype=mtype)
  d[s]=t


If there is a missing field, I get a problem in one of my rows








On Sat, Jun 27, 2009 at 9:04 AM, MRAB<python at mrabarnett.plus.com> wrote:
> Mag Gam wrote:
>>
>> I am using the csv package to parse a compressed .csv.gz file. So far
>> its working perfectly fine but it fails when I have a missing value in
>> on of the fields.
>>
>> For example, I have this
>>
>> Abc,def,,jkl
>>
>> Is it possible to fill the missing column with a null?
>>
>> I want,
>> Abc,def,NULL,jkl
>>
> What do you mean by "fails"? I get an empty string, which is what I'd
> expect.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list