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


Groups > comp.lang.python > #44566

Re: how to compare two fields in python

References <59afdc2b-ab76-40b6-8f63-4a562e288029@googlegroups.com> <mailman.1194.1367345875.3114.python-list@python.org> <bf43e88c-dcf4-48bf-b416-5f891f1b71a4@googlegroups.com>
Date 2013-04-30 19:42 +0100
Subject Re: how to compare two fields in python
From Fábio Santos <fabiosantosart@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1197.1367347358.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

> 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
column.

Check this out for an example:
http://stackoverflow.com/questions/773/how-do-i-use-pythons-itertools-groupby(most
upvoted answer)

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


Thread

how to compare two fields in python upendra kumar Devisetty <upendrakumar.devisetty@googlemail.com> - 2013-04-30 10:41 -0700
  Re: how to compare two fields in python Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-30 13:53 -0400
  Re: how to compare two fields in python Fábio Santos <fabiosantosart@gmail.com> - 2013-04-30 19:08 +0100
  Re: how to compare two fields in python Tim Chase <python.list@tim.thechases.com> - 2013-04-30 13:19 -0500
    Re: how to compare two fields in python upendra kumar Devisetty <upendrakumar.devisetty@googlemail.com> - 2013-04-30 11:22 -0700
      Re: how to compare two fields in python Fábio Santos <fabiosantosart@gmail.com> - 2013-04-30 19:42 +0100
  Re: how to compare two fields in python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-30 19:54 -0400

csiph-web