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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <fabiosantosart@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'column': 0.07; 'subject:two': 0.07; 'subject:fields': 0.09; 'cc:addr :python-list': 0.11; 'csv': 0.16; 'duplicates': 0.16; 'grouped': 0.16; 'objects.': 0.16; 'subject:compare': 0.16; 'supplying': 0.16; 'subject:python': 0.16; 'module': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'appear': 0.29; 'message-id:@mail.gmail.com': 0.30; '(most': 0.33; 'guess': 0.33; 'anywhere': 0.35; 'received:google.com': 0.35; 'list': 0.37; 'first': 0.61; 'column.': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=YfvnZQzPh5MC+6lI5UekNtHUEAgQ0w66UMyLap5L2jA=; b=w6mAvhTC4iIlz/Dume+rwC4uTKL+mfbMtVKKDxiH4ujvifInpLmySFbCSzef5gk7YT +SgP3GOFmQjFcBOXqXjiEyv+sAL/OoNZT7haD+9JViABFKBzHw7Y5/YbFvrFDS5am0N0 ubnQlKSX22T6ydKdHYXqau2qKl5UOAGrWJVm9fluoWmeaf1EKL9CFumLV9bIetHRmL8Y 21tyCyEeNxzFkwXtoC+5/N8AFLNDq4iTKSz0jirDeCl3Q2xPq/7iyDtqVbnKdYsPiE3X SeQcWcX1AbpMP3U9ht1EnIiPk7tSoeCO1FQJxqb/jmD3pwUw+vkLO44Csk5APJMHG0VA gscw==
MIME-Version 1.0
X-Received by 10.49.25.112 with SMTP id b16mr34623165qeg.21.1367347355520; Tue, 30 Apr 2013 11:42:35 -0700 (PDT)
In-Reply-To <bf43e88c-dcf4-48bf-b416-5f891f1b71a4@googlegroups.com>
References <59afdc2b-ab76-40b6-8f63-4a562e288029@googlegroups.com> <mailman.1194.1367345875.3114.python-list@python.org> <bf43e88c-dcf4-48bf-b416-5f891f1b71a4@googlegroups.com>
Date Tue, 30 Apr 2013 19:42:35 +0100
Subject Re: how to compare two fields in python
From Fábio Santos <fabiosantosart@gmail.com>
To upendra kumar Devisetty <upendrakumar.devisetty@googlemail.com>
Content-Type multipart/alternative; boundary=047d7b6da4c8694a6c04db985d74
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1197.1367347358.3114.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367347358 news.xs4all.nl 15873 [2001:888:2000:d::a6]:38441
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44566

Show key headers only | 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