Rolling window statistics for numpy arrays.
No pandas needed.
A lightweight, zero-dependency Python library for calculating fast, vectorized rolling-window statistics on 1D NumPy arrays. Built safely using memory-efficient NumPy stride tricks for instant calculations with zero memory copies.

The weight of Pandas.
The speed of C.
Data analysis tasks often import Pandas simply to compute a rolling average or standard deviation. However, Pandas brings a heavy 35 MB+ installation size, high memory overhead, and requires converting your clean NumPy arrays to DataFrames and back.
Available on PyPI, `rollit` is a zero-dependency Python package. It runs rolling statistics directly on 1D NumPy arrays at C-speed using memory strides, giving you instant vectorized results without any external bloat.
import numpy as np
import rollit
# 1D array of data (price feeds, sensor streams)
data = np.array([10.0, 20.0, 15.0, 30.0, 25.0])
# Vectorized rolling mean (window size = 3)
averages = rollit.mean(data, window=3)
print(averages)
# Output: [15.0, 21.67, 23.33]
Core Value Propositions
`rollit` provides a secure, lightweight utility designed specifically for calculation-heavy data feeds and time-series arrays.
Zero Dependencies
Calculated entirely using pure NumPy views. Avoid a heavy 35 MB pandas import just to run a single rolling-window calculation.
Segfault-Safe Memory
Direct memory modification via `as_strided` is highly dangerous. rollit bounds-checks window sizes and locks returned array flags as read-only.
Unified Simple API
One clean pattern `rollit.mean(arr, window)` across all functions, making it a drop-in replacement for pandas statistics.
Out-of-the-Box Math
Built-in rolling Z-Scores for anomaly detection, local Min-Max Normalization scaling, and custom function escape hatches.
Window Calculations
Visualize how statistics are computed as the rolling window slides across your inputs.
Control Panel
How It Works: Zero-Copy Strides
`rollit` avoids making memory copies by re-interpreting array byte steps.
NumPy Stride Tricks
Normally, calculating rolling statistics requires copying slices of the array into new memory blocks. This is slow and doubles memory usage.
rollit uses NumPy's native stride manipulation. By setting custom strides (the number of bytes to skip in memory to find the next element), it creates a 2D view pointing to the exact same 1D array blocks in physical memory.
Performance Benchmarks
Move the slider to adjust array size and compare real-world calculation times.
Controls
For 500K elements, rollit finishes in 2.50 ms, outperforming Python loops by 100x.