tsdownsample
Time series downsampling in rust
What it is and what it does
tsdownsample is a Rust-based time series downsampling library that reduces large datasets to a smaller number of points while preserving visual fidelity. It implements four downsampling algorithms—MinMax, M4, LTTB (Largest Triangle Three Buckets), and a hybrid MinMaxLTTB—each returning indices into the original data rather than copies. The library is designed to handle visualization pipelines where rendering millions of points is impractical.
The package depends only on numpy and works with a wide range of numeric types (f16, f32, f64, integers, datetime64, timedelta64, and bool for y-data). It supports optional multithreading via Rayon in Rust, bypassing Python's GIL, and includes variants for handling NaN values. The API is straightforward: instantiate a downsampler class, call its downsample method with your data and desired output count, and use the returned indices to select downsampled points from the original arrays.
Use it for:
- Downsampling stock price or sensor data with millions of points before plotting in a web dashboard or interactive visualization tool.
- Preparing large time series datasets for exploratory data analysis without losing visual representation of trends and extrema.
- Reducing memory footprint and rendering time when displaying high-frequency financial or IoT time series in real-time monitoring applications.
- Selecting representative points from irregularly sampled time series (e.g., event logs) while preserving important features.
- Accelerating data pipelines that feed large time series into machine learning models by pre-filtering to key points.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Downsamples large time series datasets to a smaller number of representative points for visualization, using Rust-based algorithms (MinMax, M4, LTTB, MinMaxLTTB) with optional multithreading.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and solves a real performance problem for time series visualization. Install friction is moderate but manageable thanks to prebuilt wheels. Choose it if you regularly work with large time series and need fast, memory-efficient downsampling; skip it if your datasets are small or you don't need visualization-specific algorithms.
Install
tsdownsample on PyPI
pip
pip install tsdownsampleuv
uv add tsdownsamplepoetry
poetry add tsdownsampleInstalling tsdownsample
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.8–3.14 across macOS, Linux (multiple architectures), and Windows, so installation is typically straightforward. Repository is active with recent commits.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install tsdownsample
from tsdownsample import MinMaxLTTBDownsampler
import numpy as np
y = np.random.randn(10_000_000)
x = np.arange(len(y))
downsampler = MinMaxLTTBDownsampler()
indices = downsampler.downsample(x, y, n_out=1000)
downsampled_x = x[indices]
downsampled_y = y[indices]
Verify before relying
- Whether the library's performance claims (e.g., 200–300x speedup for f16 argminmax) have been independently validated outside the project.
- Real-world memory overhead and performance scaling characteristics when working with datasets larger than 10 million points.
- Behavior and performance when handling time series with significant gaps or irregular sampling rates.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 74 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 622,336/month — #5,711 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tsdownsample-0.1.5.1-cp310-cp310-macosx_10_12_x86_64.whl; tsdownsample-0.1.5.1-cp310-cp310-macosx_11_0_arm64.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_24_armv7l.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_24_ppc64le.whl; tsdownsample-0.1.5.1-cp310-cp310-manylinux_2_24_s390x.whl; tsdownsample-0.1.5.1-cp310-cp310-musllinux_1_1_aarch64.whl; tsdownsample-0.1.5.1-cp310-cp310-musllinux_1_1_x86_64.whl; tsdownsample-0.1.5.1-cp310-cp310-win32.whl; tsdownsample-0.1.5.1-cp310-cp310-win_amd64.whl; tsdownsample-0.1.5.1-cp311-cp311-macosx_10_12_x86_64.whl; tsdownsample-0.1.5.1-cp311-cp311-macosx_11_0_arm64.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_24_armv7l.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_24_ppc64le.whl; tsdownsample-0.1.5.1-cp311-cp311-manylinux_2_24_s390x.whl
Keywords: time series, downsampling, rust, data science, visualization
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
lttbDownsamples time series data using the…
permissive · top 15,000 on PyPI
plotly-resamplerAdds dynamic data aggregation to Plotly…
permissive · top 15,000 on PyPI
stumpySTUMPY computes the matrix profile for time…
permissive · top 15,000 on PyPI
tslearntslearn provides machine learning algorithms…
permissive · top 15,000 on PyPI
tsdbTSDB downloads and loads 173 open-source…
permissive · top 15,000 on PyPI
pixeloeConverts standard images into pixel art using…
permissive · top 15,000 on PyPI
numpy-minmaxFinds the minimum and maximum values in a NumPy…
permissive · top 15,000 on PyPI
utilsforecastProvides utilities for time-series forecasting…
permissive · top 5,000 on PyPI
powershapPowershap performs feature selection by testing…
permissive · top 15,000 on PyPI
tsfreshAutomatically extracts hundreds of time-series…
permissive · top 15,000 on PyPI