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


Groups > comp.lang.python > #103970

Re: merging number of csv files

From alister <alister.ware@ntlworld.com>
Subject Re: merging number of csv files
Newsgroups comp.lang.python
References <a261b10a-1199-4e12-920d-7ca97927b9cd@googlegroups.com>
Message-ID <0jZBy.1409249$QP2.1150433@fx42.am4> (permalink)
Organization virginmedia.com
Date 2016-03-03 16:07 +0000

Show all headers | View raw


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"

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web