/python-tdigest-ch

A Python library for estimating quantiles in a stream, using ClickHouse t-digest data structure.

Primary LanguagePythonMIT LicenseMIT

tdigest-ch

A Python library for estimating quantiles in a stream, using ClickHouse t-digest data structure.

The t-digest data structure is designed around computing accurate quantile estimates from streaming data. Two t-digests can be merged, making the data structure well suited for map-reduce settings.

Documentation

Usage

Installation

Installing this package from sources requires a recent version of Rust.

pip install git+https://github.com/vivienm/python-tdigest-ch.git

Example

>>> from tdigest_ch import TDigest
>>> t = TDigest(range(1_000_001))
>>> round(t.quantile(0.99))
990000