csv blank fields
jkv at unixcluster.dk
Sat Jun 27 11:00:46 EDT 2009
Mag Gam wrote:
> > 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,row,row,row,row,row,row,row,row,row,row)],dtype=mtype)
> > d[s]=t
> > If there is a missing field, I get a problem in one of my rows
I had a similar problem, my problem was that in my source data (csv
file) sometimes the last cell was left out, so i ended up doing a try to
check if the row existed, if not i appended to the row.
If you want to insert a value into empty cells you can do something like
if row == ''
row = 'NULL'
More information about the Python-list