JuliaDB groupby many columns

Fabien1
Fri, 09 Apr 2021 17:10:20 +0000
General Usage

Hi guys ,

I’m trying to groupby using JuliaDB , everything works well except when i want to apply a function that takes two columns in one time.

 JuliaDB.groupby(
    (
        TOTAL_PAID = :PRICE => sum,
        FREQUENCY_IN_DAYS = :ORDER_DATE => handle_dates,
        RECENCY_IN_DAYS = :ORDER_DATE => (x -> Dates.value(Date(now()) - maximum(x))),
        COUNT_ORDERS_LAST_MONTH = :ORDER_DATE => countOnlyLastMonth,
        TOTAL_PAID_LAST_MONTH = [:ORDER_DATE, :PRICE]  => countOnlyLastMonth,
        COUNT_ORDERS = length
    ),
    t, :USER_KEY)

It’s this line that doesn’t work
TOTAL_PAID_LAST_MONTH = [:ORDER_DATE, :PRICE] => countOnlyLastMonth,
With DataFrames.groupby you would do it as following :
[:ORDER_DATE, :PRICE] => countOnlyLastMonth => :TOTAL_PAID_LAST_MONTH,

How can i do that with juliaDB ? Thank you

1 post - 1 participant