[SciPy-user] compare two csv files

Gael Varoquaux gael.varoquaux@normalesup....
Thu Jan 24 14:49:37 CST 2008


On Thu, Jan 24, 2008 at 09:45:45PM +0000, Fabian Braennstroem wrote:
> Hi,

> me again ...
> stupid question or does noone have an idea?

d = data[:, 0] - data[:,0]
# Indices where the data differ:
arange(len(d))[d <> 0]

Of course this works only if you have numerical data. If you want
something more specific, please give more info on what you are trying to
do.

Gaël


> Fabian Braennstroem schrieb am 01/22/2008 08:58 PM:
> > Hi,
> > I would like to compare two csv file; actually two columns 
> > from two csv files.
> > I would use something like:
> > def read_test():
> >      start  = time.clock()
> >      reader = csv.reader( file('data.txt') )
> >      data   = [ map(float, row) for row in reader ]
> >      data   = array(data, dtype = float)

> > To get my data into an array.

> > Does anyone have an idea, how to compare the two columns?



More information about the SciPy-user mailing list