« Why are people visiting this blog from China? | Main | A thought on Rust and LLMs. »

July 14, 2022



Why not use collections.Counter?

>>> from collections import Counter
>>> Counter([2,1,1,3,4,4,4,4,4,5,5,2,2,2])
Counter({4: 5, 2: 4, 1: 2, 5: 2, 3: 1})

Gary Robinson

Thanks qsantos! In my quest to write about more-itertools, I'd forgotten about that simpler solution. Will update my post.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)