using csvutil.q to read in csv file

Hi,

I am using csvutil.q (http://kx.com/q/e/csvutil.q) to parse csv files but having some trouble with boolean values.

e.g.

fname:`:test.csv;

info:.csv.info[fname];

info[`t]:“FSB”;

rawtab:.csv.data[fname;info];

//test.csv

1.5,A,False

4.5,B,True

The problem I’m having is with boolean type (B). The boolean values in my csv file are either “false” or “true”, and they are not parsed correctly such that all of them are set to 0 in rawtab. How do I change this csvutil.q file to make it parse this boolean values correctly? I tried some things but didn’t work. Any help appreciated

thanks

you can read the values as syms and then update.

q)rawtab:(n:1 2 3; s:FalseTrueFalse) q)update b:s=True from rawtab rawtab
q)show rawtab
n s b

1 False 0
2 True 1
3 False 0

it might be best to avoid altering csvutil.q

Problem is that although this example is simple, in my table there are close to 50 columns and 15 boolean columns, so doing it this way is cumbersome. I’ve to change the parser to get this done efficiently.

Finally was able to revise the parser to recognize “True” and “False”. thanks