Thanks a lot!
I used csvtk, works like charm :) . But I have one question, this time a tried with two small csv tables.
GENE MAP DESCRIPTION
A1BG 19q13.43 alpha
A1BG 19q13.43 antisense
A1CF 10q11.23 complementation
A2M 12p13.31 alpha
A2M 12p13.31 A2Mantisense
A2ML1 12p13.31 alpha
GENE CHROM POS
A1BG chr3 151545320
AADAT chr4 170999757
ABCA10 chr17 67178785
ABCA12 chr2 215884092
ABCA2 chr9 139904734
ABCA4 chr1 94528499
The result was:
GENE CHROM POS MAP DESCRIPTION
A1BG chr3 151545320 19q13.43 antisense
AADAT chr4 170999757
ABCA10 chr17 67178785
ABCA12 chr2 215884092
ABCA2 chr9 139904734
ABCA4 chr1 94528499
As you can see A1BG has two variants, I would like to make appear both, how would be the code for that case?
Thank you so much!
The lines/rows in dfile are not what you think they are. Try to just print them out to get a better idea:
ok, let me see if i do
I get my three rows like in csv file
What's the len() of
row? I'm not sure if you should explicitly set the field delimiter for csv.reader()e.g.
ok, now I think understand what you mean, is because I have like this:
ZSCAN30 18q12.2 zinc finger and SCAN domain containing 30
So the csv takes as 9 rows instead 3 right? The strange thing is on excel I see it just as three rows...
I converted my files from xls renamed to csv...probably I did wrong right?
The lenght of each row is about 59.000 fields
Thanks for the help!
You are mixing up rows and columns.
It can be that csv.reader() takes both spaces and tabs as delimiter, while Excel only took the tabs. If you set the delimiter explicitly, this might be solved. But having no access to your data I can only guess and suggest you what to look at.
you are right I mess up words... ^^"
Can I send you the two files? if you can help me I would really appreciate, I just want to learn how to merge files, so I can work easily adding information on my csv files.
Have you tried setting the delimiter in csv reader explicitly to tab?
What was the result of my code in C: How to merge two csv tables ?
Got this...no idea what means I m googeling
That means your code block indentation is not right, i.e. that your probably have this:
instead of this: