HelloI have problem with fliphttps://code.kx.com/trac/wiki/Cookbook/UsingKdb#WhatiftheCSVfilecontainsdatabutnocolumnnamesq)Cols: (“ISI”;“,”) 0:data.csvq)Cols0 10 20hea dfi oil481 579 77q)table: flip
ab
c!ColsThis working..But why with more cols is problem ?test: (“SSSSSS”; enlist “;”) 0:data_with_six_cols.csvafter_flip: flip
ab
cd
e`f !testafter_flip
You have:
??? (“SSSSSS”; enlist “;”)
Try:
??? (“SSSSSS”; “;”)
If the data doesn’t have a header you don’t enlist.
This not working..I have .csv with:S;S;S;S;S;SS;S;S;S;S;SS;S;S;S;S;S..etc so I think enlist must be for decode “;” delimyes.. data don’t have header.. so I want add by flip. ;/I’m new in q lang but looks very not intuitive for me with this typeproblems..On 24 Lip, 23:59, Tim Rieder <trie…> wrote:> You have:>> ? ? (“SSSSSS”; enlist “;”)>> Try:>> ? ? (“SSSSSS”; “;”)>> If the data doesn’t have a header you don’t enlist.>> On Sun, Jul 24, 2011 at 5:22 PM, reptile <my.rept…> wrote:> > Hello>> > I have problem with flip>> >https://code.kx.com/trac/wiki/Cookbook/UsingKdb#WhatiftheCSVfileconta...>> > q)Cols: (“ISI”;“,”) 0:data.csv> > q)Cols> > 0 ? 10 ?20> > hea dfi oil> > 481 579 77>> > q)table: flip
ab
c!Cols>> > This working..>> > But why with more cols is problem ?>> > test: (“SSSSSS”; enlist “;”) 0:data_with_six_cols.csv> > after_flip: flip
ab
cd
e`f !test> > after_flip>> > –> >
Submitted via Google Groups</my.rept…></trie…>
If CSV file has no header do not enlist the seperator and post process into a table (flip dict)
q)hopen[:semiColonSep.txt]"\n"sv";"sv'string (0N 6)#
$'18#.Q.A;
q)\cat semiColonSep.txt
“A;B;C;D;E;F”
“G;H;I;J;K;L”
“M;N;O;P;Q;R”
q)flip a
bc
de
f!(“SSSSSS”;“;”)0::semiColonSep.txt<br>a b c d e f<br>-----------<br>A B C D E F<br>G H I J K L<br>M N O P Q R<br></font><font style='"font-family:courier' new size='"1"'><br>----------------------------<br></font><font style='"font-family:courier' new size='"1"'><br><font style='"font-family:arial,helvetica,sans-serif"' size='"2"'>If CSV file has header just enlist the seperator, it will give you back a table:</font></font><font style='"font-family:courier' new size='"1"'><font size='"2"'></font><br><br>q)hopen[
:semiColonSepWithHeader.txt]“a;b;c;d;e;f\n”,“\n"sv”;"sv’string (0N 6)#$'18#.Q.A;<br>q)\cat semiColonSepWithHeader.txt<br>"a;b;c;d;e;f"<br>"A;B;C;D;E;F"<br>"G;H;I;J;K;L"<br>"M;N;O;P;Q;R"<br>q)("SSSSSS";enlist";")0:
:semiColonSepWithHeader.txt
a b c d e f
-----------
A B C D E F
G H I J K L
M N O P Q R
Mohammad Noor
Thank you..Now it’s work how I want..On 25 Lip, 13:13, Mohammad Noor <k…> wrote:> If CSV file has no header do not enlist the seperator and post process into> a table (flip dict)>> q)hopen[:semiColonSep.txt]"\n"sv";"sv'string (0N 6)#
$'18#.Q.A;> q)\cat semiColonSep.txt> “A;B;C;D;E;F”> “G;H;I;J;K;L”> “M;N;O;P;Q;R”> q)flip a
bc
de
f!(“SSSSSS”;“;”)0::semiColonSep.txt> a b c d e f> -----------> A B C D E F> G H I J K L> M N O P Q R>> ---------------------------->> If CSV file has header just enlist the seperator, it will give you back a> table:>> q)hopen[
:semiColonSepWithHeader.txt]“a;b;c;d;e;f\n”,“\n"sv”;“sv’string (0N> 6)#$'18#.Q.A;> q)\cat semiColonSepWithHeader.txt> "a;b;c;d;e;f"> "A;B;C;D;E;F"> "G;H;I;J;K;L"> "M;N;O;P;Q;R"> q)("SSSSSS";enlist";")0:
:semiColonSepWithHeader.txt> a b c d e f> -----------> A B C D E F> G H I J K L> M N O P Q R>> Mohammad Noor>> On Mon, Jul 25, 2011 at 11:39 AM, reptile <my.rept…> wrote:> > This not working..>> > I have .csv with:>> > S;S;S;S;S;S> > S;S;S;S;S;S> > S;S;S;S;S;S> > ..etc so I think enlist must be for decode “;” delim>> > yes.. data don’t have header.. so I want add by flip. ;/>> > I’m new in q lang but looks very not intuitive for me with this type> > problems..>> > On 24 Lip, 23:59, Tim Rieder <trie…> wrote:> > > You have:>> > > ? ? (“SSSSSS”; enlist “;”)>> > > Try:>> > > ? ? (“SSSSSS”; “;”)>> > > If the data doesn’t have a header you don’t enlist.>> > > On Sun, Jul 24, 2011 at 5:22 PM, reptile <my.rept…> wrote:> > > > Hello>> > > > I have problem with flip>> > > >https://code.kx.com/trac/wiki/Cookbook/UsingKdb#WhatiftheCSVfileconta.> > ..>> > > > q)Cols: (“ISI”;”,") 0:data.csv> > > > q)Cols> > > > 0 ? 10 ?20> > > > hea dfi oil> > > > 481 579 77>> > > > q)table: flip
ab
c!Cols>> > > > This working..>> > > > But why with more cols is problem ?>> > > > test: (“SSSSSS”; enlist “;”) 0:data_with_six_cols.csv> > > > after_flip: flip
ab
cd
e`f !test> > > > after_flip>> > > > –> > > > 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=en.>> > –> >
Submitted via Google Groups</my.rept…></trie…></my.rept…></k…>