The `tdigest` library is a Python implementation of Ted Dunning's t-digest data structure, designed for efficient and accurate percentile and quantile estimation from streaming or distributed data. It enables computations like percentiles, quantiles, and trimmed means. The current official PyPI version is 0.5.2.2, with releases focusing on performance improvements and bug fixes. The library is actively maintained with occasional updates.
pip install tdigestVerified import paths — ran on the pinned version, not inferred.
Initializes a TDigest object, updates it with data either sequentially or in batches, and demonstrates how to compute percentiles and merge two digests. Requires `numpy` for random data generation.
Replace `digest.quantile(x)` with `digest.cdf(x)`.
For the latest version, consider `pip install git+https://github.com/CamDavidsonPilon/tdigest.git` (use with caution, may not be production-ready stable).
Ensure your project uses Python 3.6+ to align with modern Python practices and better library support.
Prefer `to_dict()` and `update_from_dict()` for robust serialization, especially when saving digests for later use or cross-version compatibility.
Use the `cdf` method instead: `digest.cdf(x)`.
Upgrade `pip` to the latest version (`pip install --upgrade pip`) and ensure your Python environment supports modern TLS protocols. Consider upgrading your Python version if it's very old.
Ensure all `TDigest` objects involved in merge operations (`+` operator or `merge` method) are properly initialized and contain data. For example, `TDigest()` instead of `None`.