-
Notifications
You must be signed in to change notification settings - Fork 373
Open
Description
I often find myself doing something like
combine(groupby(df, x)) do groupdf
x = first(groupdf.x)
# ...
endIt would be nice to be able to do something along the lines of
combine(pairs(groupby(df, x))) do groupkey, groupdf
x = groupkey.x
# ...
endThere is currently no such method for combine that would accept the output of pairs(::GroupedDataFrame), which is a generator over a zip of the group keys and grouped data, a type not particularly conducive to dispatch.
I spoke a bit with @bkamins about this in Slack, who noted that:
we would have to go for:
combine(::Function, ::Base.Iterators.Enumerate{<:GroupedDataFrame})signature and require:
combine(enumerate(gdf)) do idx, sdf ... endThe only downside of this pattern (fortunately not user-visible) is that it would require a completely separate code path.
Being able to access the group index would indeed be nice if it is not feasible to access the group key.