[Tutor] Counting and grouping dictionary values in Python 2.7

Alan Gauld alan.gauld at yahoo.co.uk
Fri Jul 8 13:33:24 EDT 2016

On 08/07/16 14:22, Bruce Dykes wrote:

> with it is writing the list of dictionaries to a .csv file, and to date,
> we've been able to get by doing some basic analysis by simply using grep
> and wc, but I need to do more with it now.

I'm a big fan of using the right tool for the job.
If you got your data in CSV have you considered using a
spreadsheet to read the data and analyse it? They have lots
of formulae and stats functions built in and can do really
cool graphs etc and can read csv files natively.

Python might be a better tool if you want regular identical reports, say
on a daily basis, but for ad-hoc analysis, or at least till you know
exactly what you need, Excel or Calc are possibly better tools.

> Also, is there any particular advantage to pickling the list and having two
> files, one, the pickled file to be read as a data source, and the .csv file

Probably not, the cost of converting the strings in the csv to objects
is not that high unless you have huge volumes to manage(ie millions of

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list