csv blank fields
__peter__ at web.de
Sat Jun 27 13:12:44 EDT 2009
Mag Gam wrote:
Please don't top-post.
> Sorry if I wasn't clear before.
> While reading my csv file, notice I am putting the content in an array.
That's already in the code you posted. What's missing is the value of
"mtypes". I really meant it when I asked you to provide a self-contained
example, i. e. one that I can run on my computer.
> If lets say, row has nothing in it
No, it containes an empty string as MRAB already inferred.
> , python gives an exception.
What exception? What traceback? Please take the time to read
> Instead of the exception, I would like to assign 'NULL' to row.
The string "NULL"? That would be
for s, row in enumerate(reader):
row = tuple(c if c else "NULL" for c in row)
t = np.array([row], dtype=mtype)
I'm not a numpy expert, but creating a lot of temporary arrays does look
> Does that help?
Sorry, no. I (or someone else who doesn't bother to guess) could have come
up with a better answer in a shorter time if you had actually answered my
More information about the Python-list