Home › Forums › kdb+ › Exporting CSV file › Re: Exporting CSV file
-
I’m not following your request. I read it as follows, which I don’t think is what you mean?
q)t:([]c1:`a`b`c;c2:1 2 3) q){cc:count cols t;x:csv 0: x;(1#x),enlist[(csv sv cc# enlist enlist "t")],1_x} t "c1,c2" "t,t" "a,1" "b,2" "c,3" q)(count[cols t]#"*";enlist csv) 0: {cc:count cols t;x:csv 0: x;(1#x),enlist[(csv sv cc# enlist enlist "t")],1_x} t c1 c2 ----------- ,"t" ,"t" ,"a" ,"1" ,"b" ,"2" ,"c" ,"3"
If you prepare you csv data and read from disk, you’ll recreate a table without needing to add tabs:
q)csv 0: t “c1,c2” “a,1” “b,2” “c,3″ q)(count[cols t]#”*”;enlist csv) 0: csv 0: t c1 c2 ——— ,”a” ,”1″ ,”b” ,”2″ ,”c” ,”3″
Can you provide a before and after example of what you mean?