Skip to content

Commit

Permalink
implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeffebach committed Dec 20, 2023
1 parent 42ab3e6 commit 7bfd448
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2989,12 +2989,19 @@ macro rename!(x, args...)
end

function groupby_helper(df, args...)
cols = map(get_column_expr, args)
cols = map(args) do a
if a isa Expr && a.head == :call && a.args[1] in (:All, :Between, :Cols, :Not)
a
else
get_column_expr(a)
end
end
if any(isnothing, cols)
throw(ArgumentError("All inputs to @groupby must be valid column selectors"))
end

:($groupby($df, $make_source_concrete($reduce($vcat, $(Expr(:tuple, cols...))))))
t = Expr(:tuple, cols...)
:($groupby($df, ($Cols($t...))))
end

function groupby_helper(df, arg)
Expand Down

0 comments on commit 7bfd448

Please sign in to comment.