Install & Compatibility
Where this runs
tested against v0.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.8s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TDigest
✓ from fastdigest import TDigest
Initialize a TDigest, update it with streaming or batch data, and query for quantiles, median, and other statistics.
from fastdigest import TDigest
import random
# Create a new TDigest instance
digest = TDigest()
# Add values incrementally
for _ in range(10000):
digest.update(random.random() * 100)
# Or create from a sequence of values (with optional weights)
data = [1.42, 2.71, 3.14, 5.0, 8.0, 13.0]
digest_from_values = TDigest.from_values(data)
# Add a batch of values
digest_from_values.batch_update([1.0, 2.0, 3.0, 4.0])
# Get quantiles
median = digest.quantile(0.5)
percentile_90 = digest.quantile(0.9)
print(f"Median: {median:.2f}")
print(f"90th Percentile: {percentile_90:.2f}")
# Get the number of centroids
print(f"Number of centroids: {len(digest)}")
# Check if empty (as method)
print(f"Is digest empty? {digest.is_empty()}")
Errors
Common errors & fixes
AttributeError: 'TDigest' object has no attribute 'mass'
In versions 0.12.0 and later, `mass` was changed from a property to a method.
fixCall `mass` as a method: `digest.mass()`
AttributeError: 'TDigest' object has no attribute 'is_empty'
In versions 0.12.0 and later, `is_empty` was changed from a property to a method.
fixCall `is_empty` as a method: `digest.is_empty()`
ValueError: max_centroids must be a non-negative integer
Attempting to initialize `TDigest` or set `max_centroids` with a negative value or non-integer type.
fixEnsure that `max_centroids` is always a non-negative integer value, e.g., `TDigest(max_centroids=50)`.
TypeError: object of type 'int' has no len() (or similar when merging non-TDigest objects)
The `merge_all` method received an iterable containing objects that are not `TDigest` instances.
fixVerify that all elements in the list or iterable passed to `TDigest.merge_all()` are indeed `TDigest` objects.
MemoryError: failed to allocate TDigest (possibly during merge operation)
The `TDigest` attempted to allocate memory for a large number of centroids, exceeding available system memory. This can happen with very large merges or when `max_centroids` is set too high for the data volume.
fixConsider reducing the `max_centroids` parameter to limit memory usage, process data in smaller batches, or ensure sufficient memory is available for large operations.
Upgrade
Version history
0.12.0latest on PyPI · released Mar 15, 2026
Audit
Dependencies
numpyoptionalOptional dependency for efficient weighted updates and array-based initialization methods like `TDigest.from_values` with `w` argument.