Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103949 > unrolled thread

merging number of csv files

Started bym.t.egle@student.rug.nl
First post2016-03-03 01:46 -0800
Last post2016-03-03 16:17 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  merging number of csv files m.t.egle@student.rug.nl - 2016-03-03 01:46 -0800
    Re: merging number of csv files alister <alister.ware@ntlworld.com> - 2016-03-03 16:07 +0000
    Re: merging number of csv files Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-03 16:17 +0000

#103949 — merging number of csv files

Fromm.t.egle@student.rug.nl
Date2016-03-03 01:46 -0800
Subjectmerging number of csv files
Message-ID<a261b10a-1199-4e12-920d-7ca97927b9cd@googlegroups.com>
Hey!

I have been goggling around for the last few days and tried out many python codes.
I want to merge two csv files, say thought_probe1.csv and thought_probe2.csv. I want them to merge column-wise in a new csv file 'new_file.csv'.
What coding is smart to use in order to achieve it? 

I would really appreciate if someone could right a good code below.

Thanks so much!!

Best,
Tiber

[toc] | [next] | [standalone]


#103970

Fromalister <alister.ware@ntlworld.com>
Date2016-03-03 16:07 +0000
Message-ID<0jZBy.1409249$QP2.1150433@fx42.am4>
In reply to#103949
On Thu, 03 Mar 2016 01:46:38 -0800, m.t.egle wrote:

> Hey!
> 
> I have been goggling around for the last few days and tried out many
> python codes.
that is where you are going wrong.
you need to understand the concepts of what you are trying to do and an 
understanding of how the language works. this will allow you to write 
your own code.

once you can do this it is then possible to look at other peoples code to 
see how they have achieved their goals an modify it accordingly. to start 
by looking at others code is putting the cart before the hourse 
 


> I want to merge two csv files, say thought_probe1.csv and
> thought_probe2.csv. I want them to merge column-wise in a new csv file
> 'new_file.csv'.
> What coding is smart to use in order to achieve it?
> 
> I would really appreciate if someone could right a good code below.
> 
> Thanks so much!!
> 
> Best,
> Tiber

use the CSV module

create 2 CSV reader objects and a CSV writer object
read the data from the 2 readers
manipulate the data to the format you require
wright the new data to the CSV writer



-- 
Admiration, n.:
	Our polite recognition of another's resemblance to ourselves.
		-- Ambrose Bierce, "The Devil's Dictionary"

[toc] | [prev] | [next] | [standalone]


#103973

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2016-03-03 16:17 +0000
Message-ID<mailman.152.1457021870.20602.python-list@python.org>
In reply to#103949
On 03/03/2016 09:46, m.t.egle@student.rug.nl wrote:
> Hey!
>
> I have been goggling around for the last few days and tried out many python codes.
> I want to merge two csv files, say thought_probe1.csv and thought_probe2.csv. I want them to merge column-wise in a new csv file 'new_file.csv'.
> What coding is smart to use in order to achieve it?
>
> I would really appreciate if someone could right a good code below.
>
> Thanks so much!!
>
> Best,
> Tiber
>

Sorry, we don't write code for you.

Start with the csv module https://docs.python.org/3/library/csv.html

Alternatively try pandas http://pandas.pydata.org/

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web