[Chicago] 2 unique keys in a python dict?
John Hunter
jdh2358 at gmail.com
Thu Oct 9 18:53:34 CEST 2008
On Thu, Oct 9, 2008 at 11:19 AM, Massimo Di Pierro
<mdipierro at cs.depaul.edu> wrote:
>>>> rows=db().select(db.mytable.ttid,db.mytable.paid.sum(),orderby=db.mytable.ttid,groupby=db.mytable.ttid)
>>>> for row in rows:
> ... print 'transaction',row.ttid,'total amount',row[db.mytable.paid.sum()]
Or use matplotlib's support for CSV files via numpy record arrays
import matplotlib.mlab as mlab
r = mlab.csv2rec('myfile.csv')
print r.paid.sum()
csv2rec does type inference from the data in the file, and numpy
arrays support all the standard math and stat operations (mean, std,
logical masks, etc...)
JDH
More information about the Chicago
mailing list