Python implementation of the Hyper LogLog and Sliding Hyper LogLog cardinality counter algorithms.
Installation:
Use pip install hyperloglog to install from PyPI.
Usage:
import hyperloglog
hll = hyperloglog.HyperLogLog(0.01) # accept 1% counting error
hll.add("hello")
print(len(hll)) # 1
hll.add("hello")
print(len(hll)) # 1 as items aren't added more than once
hll.add("hello again")
print(len(hll)) # 2
If we add a further 1000 random strings (giving a total of 1002 strings) we’ll have a count roughly within 1% of the true value, in this case it counts 1007 (within +/- 10.2 of the true value)
# add 1000 random 30 char strings to hll
import random
import string
[hll.add("".join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for n in range(30)])) for m in range(1000)]
print(len(hll)) # 1007
Changes:
Added Sliding window HLL version
Added bias correction from HLL++
References:
Metadata
Release files for hyperloglog 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hyperloglog-0.1.8.tar.gz | 48.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hyperloglog-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.5 kB
Release files / hyperloglog-0.1.8.tar.gz
| Download URL | hyperloglog-0.1.8.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
919864a909e7de0168ee8de2d01a0ab6cad38806d5d2e5ad71128b32449154dc
|
|
BLAKE2b-256 checksum How to use checksums |
a09d5d93535a5cb1bcb0d261703f6f65f4783cd1c064496ad62ac3c344b08ff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / hyperloglog-0.1.8-py3-none-any.whl
| Download URL | hyperloglog-0.1.8-py3-none-any.whl |
|---|---|
| Size | 48.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
010caa5c6ff3ca131671f0ae8a1b72dc12f7ed0574439e81f1096438a782297d
|
|
BLAKE2b-256 checksum How to use checksums |
25e859a0e2d1545d2cfe78d2f824d9446abaad11a28039ea5fc5cbeb0675366b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|