dtw-python is a comprehensive Python library that provides a faithful, functionally equivalent implementation of Dynamic Time Warping (DTW) algorithms, mirroring the capabilities of the popular R 'dtw' package. It enables optimal alignment between two time series, even if they have different lengths or time axes, and supports various local (slope) and global (window) constraints. The library is currently at version 1.7.4 and maintains an active, though irregular, release cadence, with several updates per year. It is widely used for classification and clustering tasks across domains like bioinformatics, econometrics, and general time series analysis.
Verified import paths — ran on the pinned version, not inferred.
The package name for pip is 'dtw-python', but the import statement is simply 'import dtw'.
Common for interactive use, imports core functions like `dtw` and `rabinerJuangStepPattern` directly.
This quickstart demonstrates how to compute Dynamic Time Warping between two NumPy arrays. It defines a query and a template time series, then uses the `dtw()` function to find their optimal alignment. The resulting `alignment` object contains the DTW distance and can be used for plotting the warping path (if `matplotlib` is installed).
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.