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:
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hyperloglog-0.1.7.tar.gz
(48.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyperloglog-0.1.7.tar.gz.
File metadata
- Download URL: hyperloglog-0.1.7.tar.gz
- Upload date:
- Size: 48.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a70691b73ef8a5c783d3fe866e1ae0f02aa8a46c227e8a2a8bf89ca8a56ca514
|
|
| MD5 |
6c176f7ace17afb193c7fbf31238893e
|
|
| BLAKE2b-256 |
8846926d7841849eb7ac0059f6f6349f3274ddf87219aa47a643b53b7082801a
|
File details
Details for the file hyperloglog-0.1.7-py3-none-any.whl.
File metadata
- Download URL: hyperloglog-0.1.7-py3-none-any.whl
- Upload date:
- Size: 48.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
286c18e8af6bff8db21f13e5dc49d6286efb5aec4072de08de455f42c64adbca
|
|
| MD5 |
cfe240787a6c50ce36db960012269769
|
|
| BLAKE2b-256 |
1b1df23e84af9cd4abbb442fa6c625c5a2f22c41110cd3432b034c9cdd9c9410
|