Closed xiaodaigh closed 4 years ago
The problem is that @by
currently needs an expression of the form y = fun(:x)
. Your above example doesn't meet that.
In the future, we will hopefully be able to make this work by transforming mean(:val)
to :val => mean
and then putting it into DataFrames.combine(groupby(df, :grp), :val => mean)
. Initial work has started towards that goal in #163.
Unfortunately the error here is very difficult to understand because it's hard to reason exactly what expression DataFramesMeta is making at the end of the day. This will become easier to reason about after #163. It looks like @by
actually does call DataFrames.combine
currently, constructs an intermediate NamedTuple
and calls DataFrame
on that. Your expression creates a Float64
value for each group, which DataFrames.combine
doesn't know what to do with.
Rest assured this will get fixed in the future.
Fixed in #163
closing - right?
This simple MWE is throwing error . I have DataFrames 0.21.7 and DataFramesMeta 0.5.1