Re: how to compare two fields in python

2013-04-30 Thread Fábio Santos
> The data was sorted and so duplicates will not appear anywhere in the dataframe. > I guess that's it. Use the standard csv module and itertools.groupby. Groupby will produce a list of grouped objects. So you can group by the first column by supplying a key function which just returns the first c

Re: how to compare two fields in python

2013-04-30 Thread upendra kumar Devisetty
The data was sorted and so duplicates will not appear anywhere in the dataframe. The values does not have significance and can be ignored safely. Thanks Upendra On Tuesday, April 30, 2013 11:19:56 AM UTC-7, Tim Chase wrote: > On 2013-04-30 10:41, upendra kumar Devisetty wrote: > > > I have a ve

Re: how to compare two fields in python

2013-04-30 Thread Tim Chase
On 2013-04-30 10:41, upendra kumar Devisetty wrote: > I have a very basic question in python. I want to go through each > line of the a csv file and compare to see if the first field of > line 1 is same as first field of next line and so on. If it finds a > match then i would like to put that field

Re: how to compare two fields in python

2013-04-30 Thread Fábio Santos
... And collections.Counter. This is useful for (you guessed it) counting. Maybe itertools.groupby will be helpful as well (it could be used to give you your data grouped by the first column of data), but it could be a tad advanced for you if you are not too familiar with iterators. -- http://mai

Re: how to compare two fields in python

2013-04-30 Thread Joel Goldstick
On Tue, Apr 30, 2013 at 1:41 PM, upendra kumar Devisetty < upendrakumar.devise...@googlemail.com> wrote: > I have a very basic question in python. I want to go through each line of > the a csv file and compare to see if the first field of line 1 is same as > first field of next line and so on. If