{"id":5096,"library":"window-ops","title":"Window Operations","description":"The `window-ops` library provides optimized implementations of window operations such as rolling and expanding functions. It aims to offer a significant speedup over `pandas.Series.rolling` and `pandas.Series.expanding` by utilizing Numba-optimized functions that operate on NumPy arrays. The library also includes 'online' classes for efficiently updating window statistics as new data arrives. It is currently in an alpha development stage (0.0.15), with releases as features are added or improved.","status":"active","version":"0.0.15","language":"en","source_language":"en","source_url":"https://github.com/jmoralez/window_ops/tree/master/","tags":["rolling","expanding","window-functions","time-series","numba","numpy","performance"],"install":[{"cmd":"pip install window-ops","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core data structure for high-performance array operations.","package":"numpy","optional":false},{"reason":"Used for JIT compilation to achieve performance speedups.","package":"numba","optional":false}],"imports":[{"symbol":"rolling_mean","correct":"from window_ops.rolling import rolling_mean"},{"symbol":"expanding_mean","correct":"from window_ops.expanding import expanding_mean"},{"note":"For classes that allow online updates to window statistics.","symbol":"online","correct":"from window_ops import online"}],"quickstart":{"code":"import numpy as np\nfrom window_ops.rolling import rolling_mean\nfrom window_ops.expanding import expanding_mean\n\ndata = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])\n\n# Calculate rolling mean with a window size of 3\nrolling_result = rolling_mean(data, window_size=3)\nprint(f\"Original data: {data}\")\nprint(f\"Rolling mean (window=3): {rolling_result}\")\n\n# Calculate expanding mean\nexpanding_result = expanding_mean(data)\nprint(f\"Expanding mean: {expanding_result}\")","lang":"python","description":"This quickstart demonstrates how to use `window-ops` to compute rolling and expanding means on a NumPy array. The functions directly operate on NumPy arrays for performance benefits."},"warnings":[{"fix":"Ensure your input data is a NumPy array (e.g., `series.to_numpy()`) before calling `window-ops` functions.","message":"The library primarily operates on NumPy arrays. If you are working with pandas Series or DataFrames, you will need to convert your data to NumPy arrays before using `window-ops` functions and potentially convert back to pandas if needed. This is different from `pd.Series.rolling` and `pd.Series.expanding` which work directly on Series.","severity":"gotcha","affected_versions":"All versions (0.0.1 and above)"},{"fix":"Pin exact versions in your `requirements.txt` (e.g., `window-ops==0.0.15`) and review changelogs carefully when upgrading.","message":"This library is currently in 'Development Status :: 3 - Alpha'. This means the API is not yet stable and might introduce breaking changes between minor or patch versions (e.g., 0.0.x to 0.0.y) without following strict semantic versioning, although recent changes have been additive.","severity":"breaking","affected_versions":"All versions (0.0.1 and above)"},{"fix":"Use specific imports like `from window_ops.rolling import rolling_mean`.","message":"Functions like `rolling_mean` and `expanding_mean` (and other statistics) are imported directly from submodules like `window_ops.rolling` and `window_ops.expanding`, not from the top-level `window_ops` package.","severity":"gotcha","affected_versions":"All versions (0.0.1 and above)"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}