Re: itertools.groupby usage to get structured data

2011-02-07 Thread nn
On Feb 5, 7:12 am, Peter Otten <__pete...@web.de> wrote: > Slafs wrote: > > Hi there! > > > I'm having trouble to wrap my brain around this kind of problem: > > > What I have : > >   1) list of dicts > >   2) list of keys that i would like to be my grouping arguments of > > elements from 1) > >   3

Re: itertools.groupby usage to get structured data

2011-02-05 Thread Peter Otten
Slafs wrote: > Hi there! > > I'm having trouble to wrap my brain around this kind of problem: > > What I have : > 1) list of dicts > 2) list of keys that i would like to be my grouping arguments of > elements from 1) > 3) list of keys that i would like do "aggregation" on the elements > of

Re: itertools.groupby usage to get structured data

2011-02-05 Thread Slafs
On 5 Lut, 05:58, Paul Rubin wrote: > Slafs writes: > > What i want to have is: > > a "big" nested dictionary with 'g1' values as 1st level keys and a > > dictionary of aggregates and "subgroups" in it > > > I was looking for a solution that would let me do that kind of > > grouping with varia

Re: itertools.groupby usage to get structured data

2011-02-04 Thread Paul Rubin
Slafs writes: > What i want to have is: > a "big" nested dictionary with 'g1' values as 1st level keys and a > dictionary of aggregates and "subgroups" in it > > I was looking for a solution that would let me do that kind of > grouping with variable lists of 2) and 3) i.e. having also 'g3' as

Re: itertools.groupby usage to get structured data

2011-02-04 Thread Steven D'Aprano
On Fri, 04 Feb 2011 15:14:24 -0800, Slafs wrote: > Hi there! > > I'm having trouble to wrap my brain around this kind of problem: Perhaps you should consider backing up and staring from somewhere else with different input data, or changing the requirements. Just a thought. > What I have : >

itertools.groupby usage to get structured data

2011-02-04 Thread Slafs
Hi there! I'm having trouble to wrap my brain around this kind of problem: What I have : 1) list of dicts 2) list of keys that i would like to be my grouping arguments of elements from 1) 3) list of keys that i would like do "aggregation" on the elements of 1) with some function e.g. sum F