I have a bunch of Grouped DataFrames gdf that I want to combine. I want to combine the GDF with the mean var1 which is a Float and the first element of var2 which is a String.
I tried
combine(gdf, :var1 .=> mean, :var2 .=> first(:var2))
But getting the error ERROR: MethodError: no method matching iterate(::Symbol)
I also tried first(:var2, 1) .
Thanks for any help.
This is the way to do it with DataFrames.jl:
(there is no need of
.before=>and no need to pass argument tofirstexplicitly)If you would prefer to use assignment style (instead of functional style with
=>pairs) use DataFramesMeta.jl: