frequency of values in a field

Paul Rubin no.email at nospam.invalid
Wed Feb 9 14:08:24 EST 2011


noydb <jenn.duerr at gmail.com> writes:
>> counts = {}
>> for thing in long_list:
>>   key = make_key(thing)
>>   if key in counts:
>>     counts[key] += 1
>>   else:
>>     counts[key] = 1

counts = {}
for thing i long_list:
  key = make_key(thing)
  counts[key] = 1 + counts.get(key, 0)

> How do you add all the records in the particular field of interest
> into long_list?

I don't understand this question.  Where are they coming from?



More information about the Python-list mailing list