I am playing around with Query.jl. I have a big dataset with many observations per day. I would like to group the observations together by observation date and then compute mean and variance of one indicator. I use the following code for the mean:
x = @from i in df
@where Dates.year.(i.Date)>=2011
@group i by i.Date into g
@select {Date=g.key, mean=mean(g..compound)}
@collect DataFrame
end
And it works perfectly fine. In contrast, trying to do the same with the variance:
x = @from i in df begin
@where Dates.year.(i.Date)>=2011
@group i by i.Date into g
@select {Date=g.key, var=var(g..compound)}
@collect DataFrame
end
Throws the following error:
type UnionAll has no field parameters
in collect at Query\src\sinks\sink_type.jl:2
in DataFrames.DataFrame at IterableTables\src\integrations\dataframes-dataarray.jl:127
in _DataFrame at IterableTables\src\integrations\dataframes-dataarray.jl:105
in column_types at TableTraits\src\utilities.jl:20 <inlined>
Does anybody know what this is about?
Edit: I get the same error for
x = @from i in df begin
@where Dates.year.(i.Date)>=2011
@group i by i.Date into g
@select {Date=g.key, q80=quantile(g..compound,0.80)}
@collect DataFrame
end