[Chicago] 2 unique keys in a python dict?
jdh2358 at gmail.com
Thu Oct 9 21:44:45 CEST 2008
On Thu, Oct 9, 2008 at 1:02 PM, Massimo Di Pierro
<mdipierro at cs.depaul.edu> wrote:
> Not quite the same. I believe Lukasz is not looking into adding up the
> column. He is looking into grouping records by transaction id and than
> summing up records within the same transaction.
I see, if you want to group by id
import matplotlib.mlab as mlab
r = mlab.csv2rec('myfile.csv')
stats = ( ('paid', np.sum, 'paidsum')
key = ('id', )
rgroup = mlab.rec_groupby(r, key, stats)
The stats variable is a sequence of (inputname, groupby_function, outputname)
More information about the Chicago