--- id: hampel version: "1.0.2" license: unclear license_treatment: permissive maintenance: dormant --- # hampel — Python implementation of the Hampel Filter License: permissive · Maintenance: dormant · Downloads: 228.5K/mo ## What it is and what it does Hampel is a Python implementation of the Hampel filter, a statistical method for detecting and removing outliers in time-series data. It uses a sliding window approach, computing the Median Absolute Deviation (MAD) for each window and flagging observations that deviate from the median by more than a configurable threshold (n_sigma). Outliers are then replaced with the window's median value. The package works with pandas Series and numpy arrays, and returns a Result object containing the filtered data, outlier indices, medians, MAD values, and thresholds. It is designed for cleaning noisy time-series before analysis or modeling, and integrates naturally with pandas workflows via the apply method on DataFrames. Use it for: - Clean sensor or measurement data before feeding it to a machine learning model. - Detect and remove spikes in financial time-series (stock prices, trading volumes). - Preprocess IoT or monitoring data to identify equipment anomalies or sensor faults. - Prepare time-series datasets for statistical analysis or forecasting by removing outliers. - Identify and flag unusual events in log or event-stream data for further investigation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Hampel detects and filters outliers in time-series data by comparing each observation against the Median Absolute Deviation within a sliding window, replacing anomalies with median values. Yes, if you need robust outlier detection for time-series data and can tolerate dormant maintenance. The package is stable, has no known vulnerabilities, and MIT licensing poses no risk. However, verify that breaking changes in version 1.0.1 do not affect your use case, and be aware that numpy and pandas are substantial dependencies. Not recommended if you need active maintenance or frequent updates. ## Install pip install hampel uv add hampel poetry add hampel ## Installing hampel Before you install: High install friction: the package depends on numpy and pandas, which are substantial dependencies. Maintenance is dormant—last release was 1060 days ago (2023-09-19), with the last commit in 2024-02-06. Breaking changes were introduced in version 1.0.1, so upgrading requires code review. License in practice: Licensed under MIT (permissive), so you can use it freely in commercial and private projects with minimal restrictions. Quickstart: pip install hampel import pandas as pd from hampel import hampel data = pd.Series([1.0, 2.0, 3.0, 100.0, 4.0, 5.0, 6.0]) result = hampel(data, window_size=3, n_sigma=3.0) print(result.filtered_data) Requires Python >= 3.8 and numpy and pandas as runtime dependencies. Verify before relying: - Whether breaking changes in version 1.0.1 affect common use patterns or are edge-case only. - Performance characteristics on large datasets or high-dimensional data. - Whether the dormant maintenance status indicates the library is stable or at risk of incompatibility with future pandas/numpy versions. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: high - Maintenance: dormant - Downloads: 228.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags time series outlier detection, hampel filter implementation, anomaly detection sliding window, median absolute deviation filter, timeseries data cleaning, outlier removal pandas, robust statistical filtering, time-series, outlier-detection, data-cleaning [View on SkillFed](https://skillfed.io/packages/hampel) · [View on PyPI](https://pypi.org/project/hampel/)