Alim Hasanov
Alim Hasanov

Reputation: 197

kdb+ How do I import only specific columns from a CSV file into a table

Example: CSV file with 4 headers: a,b,c,d. How do I only "pick" columns b & d for example, so I end up with a q table with two columns with the b & d headers?

Upvotes: 1

Views: 1889

Answers (1)

James Little
James Little

Reputation: 2069

For columns that you want to skip, use the space character in the "types" string. So to pick 'b' and 'd' columns:

q)\cat test.csv
"a,b,c,d"
"1,blah,3,4"
q)
q)(" S J";enlist csv) 0: `:test.csv
b    d
------
blah 4

Upvotes: 3

Related Questions