skillfed

lttb

Largest-Triangle-Three-Buckets algorithm for downsampling time series-like data

lttb v0.3.2 85.6K downloads/30d#13,911 on PyPI
Permissive license DORMANT released

What it is and what it does

lttb is a numpy-based implementation of Steinarsson's Largest-Triangle-Three-Buckets algorithm, a data reduction technique specifically designed for visual representation of time series. It removes visually redundant data points while preserving the overall shape and variability, making it useful for rendering plots with fewer points and smaller file sizes. It is not a statistical aggregation or smoothing tool—it's a visual filtering method.

The package provides a single main function, `downsample()`, which takes a 2D array (time values in the first column, metric values in the second) and returns a downsampled version with a specified number of output points. Input validation is configurable: by default it checks for two columns, strictly increasing x-values, and no NaN values, but these checks can be customized or disabled.

Use it for:

  • Reduce large time series datasets for faster web-based plot rendering without losing visual fidelity.
  • Compress financial or stock price time series for display in dashboards or reports.
  • Downsample sensor or monitoring data (CPU usage, temperature, etc.) for visualization while retaining trend shape.
  • Prepare time series for interactive charting libraries where point count affects performance.
  • Filter IoT or real-time metric streams for efficient storage and display of historical data.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Downsamples time series data using the Largest-Triangle-Three-Buckets algorithm to reduce visually redundant points while preserving overall shape, built on numpy.

Yes, if you need to downsample time series for visual display. The package is lightweight, has no complex dependencies, and solves a specific problem well. The dormant maintenance status is not a blocker for stable, mature code, but verify that the algorithm meets your specific data characteristics and that you don't need active support.

Install

lttb on PyPI

pip

pip install lttb

uv

uv add lttb

poetry

poetry add lttb

Installing lttb

Before you install

Low friction: pure Python wheel with only numpy as a runtime dependency. Last release was 707 days ago; maintenance is dormant but the package is stable and has been tested against Python 3.12 and numpy 1.25.

License in practice

MIT license (permissive); you can use this freely in commercial and private projects with minimal restrictions.

Quickstart

pip install lttb

import numpy as np
import lttb

data = np.array([range(100), np.random.random(100)]).T
small_data = lttb.downsample(data, n_out=20)

Requires Python 3.8 or later and numpy; input data must be a 2D array with strictly increasing x-values (first column) by default.

Verify before relying

  • Whether the package is actively maintained or accepting contributions despite dormant status.
  • Performance characteristics on large datasets (e.g., millions of points).
  • Whether custom validators can be easily extended for domain-specific constraints.

Package facts

License not declared (permissive)
Python support supports the current Python release (~=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance dormant — 707 days since the last release
First released
Downloads 85,646/month — #13,911 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lttb-0.3.2-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: Financial and Insurance IndustryIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentTopic :: Office/Business :: Financial :: InvestmentTopic :: Scientific/Engineering :: Visualization

Tags

time series downsamplingreduce data points visualizationlttb algorithm numpylargest triangle three bucketstime series data compressionvisual data filteringdownsample timeseries
time-seriesdata-reductionvisualization

More Visualization packages