3 ms·
Also check out collections.Counter. x = collections.defaultdict(collections.Counter) x['foo']['bar'] += 1 X['foo'].most_common(10) Etc.
by joshu 15y ago
Also check out collections.Counter.
x = collections.defaultdict(collections.Counter)
x['foo']['bar'] += 1
X['foo'].most_common(10)
Etc.
- bryanh 15y agoExcellent! I didn't know about that one!