Quickly counting lots of stuff in little RAM: CountMinSketch in Python
rare-technologies.com
rare-technologies.com
https://datasketches.github.io/
Hyperloglog for fast COUNT DISTINCTs is included in this library, as well as quantile sketches, reservoir sampling sketches, theta sketches, etc.
There's no shortage of various streamed counting implementations; the sweet spot of Bounter [0], the Python lib from the original blog post, is its super simple use (drop-in replacement for Python's built-in Counter), small memory footprint & high performance (optimized C underneath).
https://ekzhu.github.io/datasketch/index.html
https://github.com/ekzhu/datasketch
I don't know how how CountMinSketch compares with Zhu's HyperLogLog and HyperLogLog++ for cardinality counting, in terms of speed/memory/accuracy. But if you're interested in Bounter you may well be interested in Zhu's code too.
Bounter includes HyperLogLog as well (mentioned in the blog post); it comes for free with its optimized CountMinSketch.