{"id":21425,"library":"hampel","title":"Hampel Filter","description":"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.","status":"active","version":"1.0.2","language":"python","source_language":"en","source_url":"https://github.com/MichaelisTrofficus/hampel_filter","tags":["outlier detection","time series","hampel filter"],"install":[{"cmd":"pip install hampel","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Core dependency for array operations","package":"numpy","optional":false},{"reason":"Optional for DataFrame input","package":"pandas","optional":true}],"imports":[{"note":"Correct import for the main filter function","symbol":"hampel","correct":"from hampel import hampel"}],"quickstart":{"code":"import numpy as np\nfrom hampel import hampel\n\ndata = np.array([1, 2, 1, 2, 10, 2, 1, 2, 1])\nresult = hampel(data, window_size=3, n_sigma=3.0)\nprint(result.filtered_data)\nprint(result.outliers)","lang":"python","description":"Simple outlier detection on a numpy array."},"warnings":[{"message":"The hampel function returns a namedtuple-like object, not a tuple. Access fields using .filtered_data and .outliers, not by index.","severity":"gotcha","affected_versions":">=1.0"},{"message":"The '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.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Access attributes directly: result.filtered_data or result.outliers.","cause":"Trying to call the result of hampel as a function, e.g., result()","error":"TypeError: 'tuple' object is not callable"},{"fix":"Set window_size to at least 2 (recommended 3 or more).","cause":"window_size too small, minimum is 2","error":"ValueError: window_size must be >= 2"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}