Skip to content

Instantly share code, notes, and snippets.

@vochicong
Created August 20, 2021 02:47
Show Gist options
  • Save vochicong/00387f91aa128deecada81827d3ba7ad to your computer and use it in GitHub Desktop.
Save vochicong/00387f91aa128deecada81827d3ba7ad to your computer and use it in GitHub Desktop.
groupby-dataframes.jl
df = DataFrame(g=[1,2,3,1,2,1], e=[10,20,30,11,21,12])
df.groupby("g").agg(list)
df_grouped_elements = @chain df begin
@groupby(:g)
@combine(:e = [collect(:e)])
end
using DataFrames, DataFrameMacros, Chain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment