JuliaData / DataAPI.jl

A data-focused namespace for packages to share functions
Other
33 stars 13 forks source link

Add `combine` #65

Open rafaqz opened 2 weeks ago

rafaqz commented 2 weeks ago

I should have added this in #64.

But it makes sense to add combine here to so that DimensionalData.jl can use it and not clash with DataFrames.jl.

One question I have is the argument order. In DD it would make sense to do something like:

combine(mean, groupby(dimarray, Ti=>month); dims=Ti)

And allow a do block for the function in combine.

But DataFrames.jl is using a different syntax: combine(df, [:X, :Y] .=> mean) where the functions are in the second argument, and they are connected to columns so a do block cant work anyway.

Maybe the rule can be the extending package must either 1. own the first argument, or 2. own the second argument where the first is <:Function ? With the downside that the owned object cant be <: Function in 1.

The other option is DD uses combine(groupby(dimarray, Ti=>month), mean; dims=Ti), its just unfortunate to break the usual function-first argument order.