--- id: tsdownsample version: "0.1.5.1" license: MIT license_treatment: permissive maintenance: active --- # tsdownsample — Time series downsampling in rust License: permissive · Maintenance: active · Downloads: 622.3K/mo ## 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 above — 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 pip install tsdownsample uv add tsdownsample poetry add tsdownsample ## Installing 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_current - Install friction: medium - Maintenance: active - Downloads: 622.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags time series downsampling, data visualization decimation, large dataset reduction, fast time series sampling, LTTB downsampling, minmax downsampling algorithm, rust time series processing, time-series, visualization, rust-binding [View on SkillFed](https://skillfed.io/packages/tsdownsample) · [View on PyPI](https://pypi.org/project/tsdownsample/)