Skip to content

Releases: aravindavk/dataframes-d

v1.1.0

12 Oct 16:21
6744a6b

Choose a tag to compare

Added a new feature: rolling

Use this to apply aggregation function over a moving window. For example, to calculate the Simple moving average for the Price data.

//                           FUNC  RETTYPE WINDOW
df.sma21 = df.close.rolling!(mean, double)(21);

To use the cusom function with rolling. Example Exponential Moving Average:

double[] ema(T)(T arr, int period)
{
    double prevEMA;
    auto multiplier = 2.0 / (period + 1);

    double emaFunc(int[] data)
    {
        if (isNaN(prevEMA))
        {
            prevEMA = mean(data);
            return prevEMA;
        }

        auto lastValue = data[$-1];

        prevEMA = lastValue * multiplier + prevEMA * (1 - multiplier);
        return prevEMA;
    }

    return arr.rolling!(emaFunc, double)(period);
}

void main()
{
    auto window = 2;
    auto arr = [10, 20, 30, 40, 50, 60, 70, 82, 91, 100];
    writeln("SMA: ", arr.rolling!(mean, double)(window));
    writeln("EMA: ", arr.ema(window));
}

v1.0.3

18 Nov 17:54

Choose a tag to compare

v1.0.2

29 Oct 15:15

Choose a tag to compare

Make Column and Row type available after import dataframes

v1.0.1

28 Oct 09:23

Choose a tag to compare

  • Column!T.data is changed to Column!T.values
  • Added support to create a new DataFrame from the list of the rows or from a DataFrame.

v1.0.0

26 Oct 16:00

Choose a tag to compare

First Release!