Installing rollit & Basic Usage
Learn how to set up rollit, verify system requirements, and run your first vectorized moving average calculation using memory strides without Pandas overhead.
Installation
Install `rollit` from PyPI using pip. The library is a single-module implementation and compiles no custom C extensions, making it instant to install.
Successful installation adds the package as a light 50 KB footprints library.
Requirements
Unlike other analytics libraries, `rollit` doesn't require a full stack of heavy data packages. Here are the core specifications:
| Dependency | Required Version |
|---|---|
| Python | 3.8 or higher |
| NumPy | 1.20 or higher |
| Pandas | None required (completely independent) |
Your First Rolling Stat
Let's compute a simple 3-period rolling mean on a 1D NumPy array. Copy the following script to verify your installation:
import rollit
# 1. Create a 1D NumPy array representing data points
data = np.array([10.0, 12.0, 15.0, 13.0, 16.0, 18.0, 20.0])
# 2. Compute simple 3-day moving average
ma = rollit.mean(data, window=3)
print("Calculated Rolling Means:", ma)
# Output: [12.33, 13.33, 14.67, 15.67, 18.00]
print("Length comparison: Input =", len(data), "| Output =", len(ma))
# Output: Length comparison: Input = 7 | Output = 5
Why is the output array shorter?
In rolling window operations, the first few elements do not have enough preceding points to form a complete window. By default, `rollit` only returns valid window calculations, making the output array length follow the math formula: Output Length = Input Length - Window Size + 1.