Skip to main content

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:

  1. http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf

  2. http://hal.archives-ouvertes.fr/docs/00/46/53/13/PDF/sliding_HyperLogLog.pdf

  3. http://research.google.com/pubs/pub40671.html

https://deepwiki.com/badge.svg

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)

Source distribution for hyperloglog 0.1.8
File Size Uploaded
hyperloglog-0.1.8.tar.gz 48.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hyperloglog 0.1.8
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page