Registry / data / hampel

hampel

JSON →
library1.0.2pypypi✓ verified 84d ago

Python implementation of the Hampel Filter for outlier detection in time series. Current version 1.0.2, requires Python >=3.8. Maintained as of 2025.

pip install hampel
INSTALL
IMPORT
SIG · HAMPEL
H
hampel
datapythonv1.0.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
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.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

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

hampel
from hampel import hampel
Correct import for the main filter function

Simple outlier detection on a numpy array.

import numpy as np from hampel import hampel data = np.array([1, 2, 1, 2, 10, 2, 1, 2, 1]) result = hampel(data, window_size=3, n_sigma=3.0) print(result.filtered_data) print(result.outliers)
Debug
Known issues
gotchaThe hampel function returns a namedtuple-like object, not a tuple. Access fields using .filtered_data and .outliers, not by index.
affects: >=1.0
gotchaThe 'window_size' parameter is half-window, meaning a value of 3 uses 3 points to each side (total window 7). This differs from some other implementations.
affects: >=1.0
Errors
Common errors & fixes
TypeError: 'tuple' object is not callable
Trying to call the result of hampel as a function, e.g., result()
fix
Access attributes directly: result.filtered_data or result.outliers.
ValueError: window_size must be >= 2
window_size too small, minimum is 2
fix
Set window_size to at least 2 (recommended 3 or more).
Upgrade
Version history
1.0.2latest on PyPI · released Sep 19, 2023
Audit
Dependencies
numpyrequiredCore dependency for array operations
pandasoptionalOptional for DataFrame input
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
hampel — pip install hampel · libregistry