Skip to main content

arrayflux

Python NumPy SciPy PyTest Rolling Subclass

Tired of not having rolling method on NumPy arrays I created arrayflux!


arrayflux is a lightweight, production-ready Python library that extends numpy.ndarray with efficient rolling-window operations, fully compatible with NumPy semantics, slicing, memory model, and ufunc system.

📦 Installation (PyPI Package)

pip install arrayflux

⚙️ Usage Example

from arrayflux import arrayflux

x = arrayflux([1, 2, 3, 4, 5, 6])
r = x.rolling(3)

print(r.mean())  # [nan nan 2. 3. 4. 5.]

💡 How it works

I was tired of not having a native rolling method on NumPy arrays, and since I didn’t want to use pandas for this specific need, I created arrayflux. The idea is simple: extend NumPy’s ndarray with a clean and intuitive .rolling() API while keeping full NumPy compatibility and behavior.

Under the hood, the user interacts only with a small public API exposed in api.py, which provides a function that accepts any iterable and returns an ArrayFlux object. The ArrayFlux class itself lives in core.py, where the new method converts the input iterable into a NumPy array and applies .view(ArrayFlux) so that the object keeps all ndarray properties. The same class implements the .rolling(window) method, which performs a lazy import of the Rolling class and instantiates it using the desired window size. The Rolling class, defined in rolling.py, builds the actual rolling-window representation using numpy.lib.stride_tricks.sliding_window_view. All rolling operations (mean, std, var, skew, kurtosis, covariance, correlation, etc.) operate directly on this windowed view, and results are padded with leading NaN values to preserve the original array length.

The goal of arrayflux is to provide a lightweight, NumPy-native rolling system that is easy to use, easy to integrate, and fast to compute, without relying on heavier dependencies or abandoning the ndarray model.

🪪 License

MIT © 2025 — Developed with ❤️ by Lorenzo Santarsieri

Metadata

Release files for arrayflux 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arrayflux 0.1.1
File Size Uploaded
arrayflux-0.1.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arrayflux 0.1.1
File Interpreter ABI Platform
arrayflux-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / arrayflux-0.1.1.tar.gz

Download URL arrayflux-0.1.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a7261af5f042fb1568022b6c9f9dad2132b3397a5ebf3cf3bf0d4db81d771f2a
BLAKE2b-256 checksum
How to use checksums
e1f383a293e8ba8754d4061a6bf705efa1b0753b1709ca956ad2977b306bdd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / arrayflux-0.1.1-py3-none-any.whl

Download URL arrayflux-0.1.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1acae54eea89b0bfa4848afc693413e7cc272945205d4b31f25ea972defcde65
BLAKE2b-256 checksum
How to use checksums
8434195dc58a705d251c7d3b6edea56d10f298da3c619c1d08bb3ff064dd8f8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page