Skip to main content

rolling_apply

Function rolling_apply 

Source
pub fn rolling_apply(
    py: Python<'_>,
    series: Py<PyAny>,
    window: usize,
    func: Py<PyAny>,
) -> PyResult<Py<PyAny>>
Expand description

Rolling window operations on pandas Series with scirs2 functions

ยงExample (Python)

import pandas as pd
import scirs2

s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])

# Calculate rolling mean with window size 3
rolling_mean = scirs2.rolling_apply(s, 3, scirs2.mean_py)