16 Aug
2013
16 Aug
'13
10:43 a.m.
On Aug 16, 2013 11:05 AM, "Steven D'Aprano"
I'll provide two functions: mode, which returns the single value with the
highest frequency, or raises; and a second function, which collates the data into a sorted (value, frequency) list. Bike-shedding on the name of this second function is welcomed :-) I'd call it counts() and prefer an OrderedDict for easy lookup. By that point you're very close to Counter though (which it currently uses internally). Oscar