Registry / data / stumpy

stumpy

JSON →
library1.14.1pypypi✓ verified 85d ago

STUMPY is a powerful and scalable Python library that efficiently computes the matrix profile, a novel data structure for time series analysis. This allows for a variety of time series data mining tasks such as pattern/motif discovery, anomaly detection, semantic segmentation, and more. It is currently at version 1.14.1 and maintains an active development cycle with regular releases.

pip install stumpy
INSTALL
IMPORT
SIG · STUMPY
S
stumpy
datapythonv1.14.1
Install
10.8s avg
Import
5588ms
Disk
412MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.14.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 10.8s · import 5.588s · 411MB
412MB installed
● package 412MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stumpy
import stumpy
Standard import for the library.
numpy
import numpy as np
Often used in conjunction with stumpy for array manipulation and data generation.

This quickstart demonstrates how to compute the matrix profile for a 1-dimensional time series using the `stumpy.stump` function. The `m` parameter specifies the window size for subsequences. The output `matrix_profile` array contains crucial information about each subsequence's nearest neighbor.

import stumpy import numpy as np # Generate a random time series your_time_series = np.random.rand(1000) # Define a window size (m) for subsequences window_size = 50 # Compute the matrix profile matrix_profile = stumpy.stump(your_time_series, m=window_size) print(f"Matrix Profile shape: {matrix_profile.shape}") # The matrix_profile array contains 4 columns: # 0: Nearest neighbor distance (matrix profile value) # 1: Nearest neighbor index # 2: Left nearest neighbor index # 3: Right nearest neighbor index
Debug
Known issues
breakingPython Version Requirement: STUMPY requires Python 3.10 or newer. Users on older Python versions (e.g., 3.9 or earlier) will encounter installation or runtime errors.
fix
Upgrade your Python environment to 3.10 or later.
affects: <1.14.0
gotchaWindow Size (m) Selection: Choosing an appropriate window size (`m`) for `stumpy.stump` is critical. An ill-chosen `m` can lead to uninformative or misleading matrix profiles. The optimal `m` is highly dependent on the nature of your time series and the patterns you are looking for.
fix
Experiment with different `m` values, leverage domain knowledge, or consider using tools like the Pan Matrix Profile for broader exploration.
affects: All
gotchaUnderstanding Matrix Profile Output: The `stumpy.stump` function returns a NumPy array with four specific columns: `[distance, index, left_index, right_index]`. Misinterpreting these columns, especially the 'index' (nearest neighbor) versus 'left_index'/'right_index' (directional nearest neighbors), is a common footgun.
fix
Always refer to the official documentation for the precise meaning of each column in the output array. The `index` column gives the location of the nearest neighbor, while `left_index` and `right_index` provide indices for neighbors only to the left or right, respectively (with `-1` indicating no such neighbor exists).
affects: All
gotchaGPU Acceleration Requires NVIDIA and CUDA: While STUMPY supports GPU acceleration (e.g., with `stumpy.gpu_stump`), this functionality relies on Numba's CUDA JIT compiler. This means you need an NVIDIA GPU and the appropriate CUDA Toolkit installed on your system; simply installing STUMPY will not automatically provide GPU capabilities.
fix
Ensure you have an NVIDIA GPU and the CUDA Toolkit properly installed and configured if you intend to use GPU-accelerated functions. Otherwise, STUMPY will default to CPU computations.
affects: All
deprecatedNumPy Version Adherence to NEP 29: STUMPY follows NEP 29 (NumPy Enhancement Proposal 29) for its supported Python and NumPy versions. This means that older NumPy versions will eventually be dropped from support without specific breaking changes from STUMPY itself, but due to upstream dependency policy.
fix
Regularly update NumPy to a recent, supported version to ensure compatibility and access to the latest features and bug fixes.
affects: Future versions (as per NEP 29 rolling policy)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'stumpy'
The `stumpy` library has not been installed in the current Python environment.
fix
pip install stumpy
ValueError: T must be a 1-D numpy array.
The input time series `T` is not a 1-dimensional NumPy array, or it's a Pandas Series that needs explicit conversion.
fix
Ensure the input is converted to a 1-D NumPy array, for example, `T.values.astype(float)` for a Pandas Series or `T.flatten()` for an array with incorrect dimensions.
ValueError: m must be smaller than or equal to the length of your time series T.
The specified window size `m` is greater than the length of the input time series `T`, which is not allowed.
fix
Choose a window size `m` that is strictly less than or equal to the length of the time series `T`.
RuntimeWarning: invalid value encountered in true_divide
The input time series `T` contains `NaN` (Not a Number) values, which results in undefined mathematical operations during matrix profile computation.
fix
Preprocess the input time series `T` to handle `NaN` values by imputation (e.g., mean, median, interpolation) or removal before passing it to `stumpy` functions. Example: `T_clean = pd.Series(T).fillna(method='ffill').fillna(method='bfill').values`.
Upgrade
Version history
1.14.1latest on PyPI · released Feb 8, 2026
Audit
Dependencies
numpyrequiredCore numerical operations.
numbarequiredJust-in-Time (JIT) compilation for performance optimization, including parallel and GPU computations.
scipyrequiredScientific computing utilities.
daskoptionalFor distributed computing with `stumpy.stumped`.
matplotliboptionalCommonly used for plotting results in examples and tutorials.
Agent activity
58 hits · last 30 days
node
46
OpenAI (training)
1
Resources
stumpy — pip install stumpy · libregistry