Is it possible to load in csv files without column headings, and thenname the columns after you load the file in?If not, is it possible to load in a csv file with 2 columns withoutheadings and then make a dictionary of the 2 columns?Thanks,Nick
As always, as soon as you ask a question you realise the solution.For the dictionary I could just do the bla:(“IS”;enlist “,”) 0:`$filenameThendict:(first each bla)! last each blaI’m still unsure of how you could name the columns once they come inif there are more than two columns.Any ideas?Thanks,NickOn Feb 15, 12:08?pm, Nick <nickmcd…> wrote:> Is it possible to load in csv files without column headings, and then> name the columns after you load the file in?>> If not, is it possible to load in a csv file with 2 columns without> headings and then make a dictionary of the 2 columns?>> Thanks,>> Nick</nickmcd…>
Thanks Simon,NickOn Feb 15, 12:16?pm, Simon Garland <si…> wrote:> https://code.kx.com/trac/wiki/Cookbook/UsingKdb#WhatiftheCSVfileconta...>> On 15 February 2011 13:12, Nick <nickmcd…> wrote:>> > As always, as soon as you ask a question you realise the solution.>> > For the dictionary I could just do the bla:(“IS”;enlist “,”) ?0:`> > $filename>> > Then> > dict:(first each bla)! last each bla>> > I’m still unsure of how you could name the columns once they come in> > if there are more than two columns.>> > Any ideas?>> > Thanks,>> > Nick>> > On Feb 15, 12:08 pm, Nick <nickmcd…> wrote:> > > Is it possible to load in csv files without column headings, and then> > > name the columns after you load the file in?>> > > If not, is it possible to load in a csv file with 2 columns without> > > headings and then make a dictionary of the 2 columns?>> > > Thanks,>> > > Nick</nickmcd…></nickmcd…></si…>
[1253]$ cat > test.csv
abc,123
def,456
[1254]$ rlwrap q
…
q)sym
num!(“SI”;“,”) 0: `:test.csv // don’t enlist the delimiter if =
you don’t have col headers
sym| abc def
num| 123 456
q)flip sym
num!(“SI”;“,”) 0: `:test.csv // you can flip it into a =
table=20
sym num
abc 123
def 456=20
q)(“SI”;enlist “,”) 0: `:test.csv // if you enlist the delimiter q uses =
first row as headers
abc 123
def 456
-----Original Message-----
From: personal-kdbplus@googlegroups.com =
[mailto:personal-kdbplus@googlegroups.com] On Behalf Of Nick
Sent: Tuesday, February 15, 2011 7:08 AM
To: Kdb+ Personal Developers
Subject: [personal kdb+] csv’s without column headings
Is it possible to load in csv files without column headings, and then =
name the columns after you load the file in?
If not, is it possible to load in a csv file with 2 columns without =
headings and then make a dictionary of the 2 columns?
Thanks,
Nick
–
You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
To post to this group, send email to personal-kdbplus@googlegroups.com.
To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=3Den.
-------------------------------------------------------------------------=
NOTICE: Morgan Stanley is not acting as a municipal advisor and the =
opinions or views contained herein are not intended to be, and do not =
constitute, advice within the meaning of Section 975 of the Dodd-Frank =
Wall Street Reform and Consumer Protection Act. If you have received =
this communication in error, please destroy all electronic and paper =
copies and notify the sender immediately. Mistransmission is not =
intended to waive confidentiality or privilege. Morgan Stanley reserves =
the right, to the extent permitted under applicable law, to monitor =
electronic communications. This message is subject to terms available at =
the following link: http://www.morganstanley.com/disclaimers. If you =
cannot access these links, please notify us by reply message and we will =
send the contents to you. By messaging with Morgan Stanley you consent =
to the foregoing.