merging number of csv files

alister alister.ware at ntlworld.com
Thu Mar 3 11:07:24 EST 2016


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"



More information about the Python-list mailing list