--- id: dtw-python version: "1.7.5" license: GPL-3.0-or-later license_treatment: copyleft maintenance: active --- # dtw-python — A comprehensive implementation of dynamic time warping (DTW) algorithms. License: copyleft · Maintenance: active · Downloads: 250.9K/mo ## What it is and what it does dtw-python is a comprehensive implementation of Dynamic Time Warping algorithms for computing optimal alignments between time series. It measures how much temporal stretching or compression is needed to map one sequence onto another, outputting both the cumulative distance and the warping function (alignment path) itself. The package is widely used for time series classification, clustering, and pattern matching in domains like econometrics, chemistry, and bioinformatics. The implementation supports arbitrary local constraints (symmetric, asymmetric, slope-limited step patterns) and global windowing constraints (Sakoe-Chiba band, Itakura parallelogram), partial matches (open-begin, open-end, substring), and proper normalization. It wraps fast native C code and depends on numpy and scipy for numerical operations. The package is a faithful Python port of R's established DTW package. Use it for: - Classify or cluster financial time series (stock prices, economic indicators) by measuring temporal similarity. - Match speech or audio signals with different playback speeds or durations for speaker recognition or phoneme alignment. - Align medical time series (ECG, EEG, rehabilitation motion data) to detect patterns despite temporal variations. - Compare DNA or protein sequences with variable-length insertions/deletions in bioinformatics workflows. - Detect anomalies in sensor data by computing DTW distance to a reference normal pattern. - Perform real-time sequence matching with open-end constraints for streaming or incomplete time series. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes Dynamic Time Warping alignments between time series, measuring optimal temporal correspondence and cumulative distance with support for windowing and step-pattern constraints. Yes, if you need time series alignment or distance computation. Active maintenance, no known vulnerabilities, broad Python version support (3.9–3.13), and prebuilt wheels minimize friction. GPL-3.0-or-later copyleft is a blocker only if you cannot open-source your code. The package is production-stable and widely cited in academic literature. ## Install pip install dtw-python uv add dtw-python poetry add dtw-python ## Installing dtw-python Before you install: Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.9–3.13 on macOS (x86_64, arm64), Linux (x86_64, aarch64), and Windows. Actively maintained with recent releases. License in practice: GPL-3.0-or-later copyleft license; use in proprietary software requires either licensing negotiation or release of your own code under GPL-3.0 or later. Quickstart: import numpy as np from dtw import dtw query = np.array([1, 2, 3, 4, 5]) reference = np.array([1, 2, 2, 3, 4, 5]) dist, cost_matrix, acc_cost_matrix, path = dtw(query, reference) Requires numpy and scipy; Python >= 3.9. Verify before relying: - Performance characteristics (speed, memory usage) for typical time series lengths and multivariate data. - Availability and quality of visualization/plotting functions mentioned in description. - Whether all Rabiner-Juang, Sakoe-Chiba, and Rabiner-Myers step patterns are fully implemented. ## Package facts - License: GPL-3.0-or-later (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 250.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dynamic time warping alignment, time series distance matching, dtw algorithm python, temporal sequence alignment, time series warping function, sequence matching with constraints, time series classification dtw, time-series-analysis, sequence-alignment, scientific-computing [View on SkillFed](https://skillfed.io/packages/dtw-python) · [View on PyPI](https://pypi.org/project/dtw-python/)