Signature Description Parameters
#include <DataFrame/DataFrameStatsVisitors.h>

template<typename F, typename T, typename I = unsigned long>
struct StepRollAdopter;
        
This is a “single action visitor”, meaning it is passed the whole data vector in one call and you must use the single_act_visit() interface.

This functor applies functor F to the data in a rolling progression. It applies F to every Nth item, always starting from the first item. N is given in the constructor
The result is the result of F (i.e. visitor) result. This is somewhat similar to numpy array[N::M]
    StepRollAdopter(F &&functor, std::size_t period);
        
F: Functor type
T: Column data type
I: Index type
static void test_StepRollAdopter()  {

    std::cout << "\nTesting StepRollAdopter{ } ..." << std::endl;

    std::vector<unsigned long>  idx =
        { 123450, 123451, 123452, 123453, 123454, 123455, 123456, 123457, 123458, 123459, 123460, 123461, 123462, 123463,
          123464, 123458, 123459, 123460, 123461, 123462
        };
    std::vector<double> d1 = { 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 };
    MyDataFrame         df;

    df.load_data(std::move(idx), std::make_pair("col_1", d1));

    StepRollAdopter<MeanVisitor<double>, double>  mean_roller(MeanVisitor<double>(), 5);
    auto                                          result = df.single_act_visit<double>("col_1", mean_roller).get_result();

    assert(result == 1.0);

    StepRollAdopter<MeanVisitor<double>, double>  mean_roller2(MeanVisitor<double>(), 3);

    result = df.single_act_visit<double>("col_1", mean_roller2).get_result();
    assert(result == 2.857142857142857);
}
C++ DataFrame