Re: [Tutor] Help with iterators

2013-03-27 Thread Matthew Johnson
ors (Steven D'Aprano) > 4. Re: Help with iterators (Mitya Sirenef) > 5. Please Help (Arijit Ukil) > > > -- > > Message: 1 > Date: Thu, 21 Mar 2013 21:39:12 -0400 > From: Mitya Sirenef > To: tutor@python.org > Subject: Re: [Tutor] Help with iter

Re: [Tutor] Help with iterators

2013-03-21 Thread Mitya Sirenef
On 03/21/2013 10:20 PM, Steven D'Aprano wrote: On 22/03/13 12:39, Mitya Sirenef wrote: > >> You can do it with groupby like so: >> >> >> from itertools import groupby >> from operator import itemgetter >> >> maxDate = "2013-03-21" >> mmax = list() >> >> obs.sort(key=itemgetter('date')) >> >> fo

Re: [Tutor] Help with iterators

2013-03-21 Thread Steven D'Aprano
On 22/03/13 12:39, Mitya Sirenef wrote: You can do it with groupby like so: from itertools import groupby from operator import itemgetter maxDate = "2013-03-21" mmax= list() obs.sort(key=itemgetter('date')) for k, group in groupby(obs, key=itemgetter('date')): group = [dob for dob

Re: [Tutor] Help with iterators

2013-03-21 Thread Steven D'Aprano
On 22/03/13 11:39, Matthew Johnson wrote: Dear list, I have been trying to understand out how to use iterators and in particular groupby statements. I am, however, quite lost. groupby is a very specialist function which is not very intuitive to use. Sometimes I think that groupby is an excell

Re: [Tutor] Help with iterators

2013-03-21 Thread Mitya Sirenef
On 03/21/2013 08:39 PM, Matthew Johnson wrote: Dear list, > > I have been trying to understand out how to use iterators and in > particular groupby statements. I am, however, quite lost. > > I wish to subset the below list, selecting the observations that have > an ID ('realtime_start') value th

[Tutor] Help with iterators

2013-03-21 Thread Matthew Johnson
Dear list, I have been trying to understand out how to use iterators and in particular groupby statements. I am, however, quite lost. I wish to subset the below list, selecting the observations that have an ID ('realtime_start') value that is greater than some date (i've used the variable name m