Install & Compatibility
Where this runs
tested against v0.0.15 · 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
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 7.4s · import 0.766s · 285MB
282MB installed
● package 282MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
rolling_mean
✓ from window_ops.rolling import rolling_mean
expanding_mean
✓ from window_ops.expanding import expanding_mean
online
✓ from window_ops import online
For classes that allow online updates to window statistics.
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.
import numpy as np
from window_ops.rolling import rolling_mean
from window_ops.expanding import expanding_mean
data = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])
# Calculate rolling mean with a window size of 3
rolling_result = rolling_mean(data, window_size=3)
print(f"Original data: {data}")
print(f"Rolling mean (window=3): {rolling_result}")
# Calculate expanding mean
expanding_result = expanding_mean(data)
print(f"Expanding mean: {expanding_result}")
Debug
Known issues
gotchaThe 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.fixEnsure your input data is a NumPy array (e.g., `series.to_numpy()`) before calling `window-ops` functions.
affects: All versions (0.0.1 and above)
breakingThis 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.fixPin exact versions in your `requirements.txt` (e.g., `window-ops==0.0.15`) and review changelogs carefully when upgrading.
affects: All versions (0.0.1 and above)
gotchaFunctions 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.fixUse specific imports like `from window_ops.rolling import rolling_mean`.
affects: All versions (0.0.1 and above)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'window_ops'
The 'window-ops' library is not installed in the current Python environment.
fixpip install window-ops
ModuleNotFoundError: No module named 'window_ops.online'
The 'online' classes are directly exposed in the top-level 'window_ops' namespace, so attempting to import them from 'window_ops.online' directly will result in a ModuleNotFoundError.
fixImport the specific online class directly from the top-level 'window_ops' package. Example: `from window_ops import OnlineRollingSum`
TypeError: '<=' not supported between instances of 'numpy.ndarray' and 'int'
A NumPy array was mistakenly passed as the 'window_size' argument to a window operation class constructor, which strictly expects an integer.
fixInstantiate the window operation class with an integer `window_size`, then call the instance with the data. Example: `import numpy as np; from window_ops import RollingSum; data = np.array([1, 2, 3]); rs = RollingSum(window_size=2); result = rs(data)`
TypeError: 'list' object cannot be interpreted as an array
The underlying Numba-optimized window-ops functions expect NumPy arrays or pandas Series as input, but a standard Python list was provided.
fixConvert the Python list to a NumPy array or a pandas Series before passing it to the window operation instance. Example: `import numpy as np; from window_ops import RollingSum; my_list = [1, 2, 3]; rs = RollingSum(window_size=2); result = rs(np.array(my_list))`
Upgrade
Version history
0.0.15latest on PyPI · released Mar 4, 2024
Audit
Dependencies
numpyrequiredCore data structure for high-performance array operations.
numbarequiredUsed for JIT compilation to achieve performance speedups.