# Alternatives to Query.jl for aggregation

**URL:** https://discourse.julialang.org/t/alternatives-to-query-jl-for-aggregation/85496
**Category:** General Usage
**Created:** [August 8, 2022, 6:04pm UTC](https://discourse.julialang.org/t/alternatives-to-query-jl-for-aggregation/85496 "2022-08-08T18:04:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)
#### Post date: [August 8, 2022, 6:04pm UTC](https://discourse.julialang.org/t/alternatives-to-query-jl-for-aggregation/85496/1 "2022-08-08T18:04:42Z")

</div>

Hi everybody,

I am looking for a way to aggregate my data like Query.jl. Usually, I would run something like:

```julia
test_df = DataFrame(A = [1,1,2,2], B = [missing, 1, missing, 2])

df_agg = test_df |>
       @groupby(_.A) |>
       @map({key = key(_),
           B = first(_.B),
           B_last = last(_.B),
           B_mean = mean(skipmissing(_.B))}) |> DataFrame

```

But since Query.jl does not support missing values, mean(skipmissing(…)) will return always missing, as long there are some missing values in a specific period. I tripped over this one too many times with no obvious solution within Query.jl itself.

Of course, I can generate the mean myself and then do first(\_.B\_mean), but I wanted to know whether there is a viable alternative.

Thank you very much!

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [August 8, 2022, 6:32pm UTC](https://discourse.julialang.org/t/alternatives-to-query-jl-for-aggregation/85496/2 "2022-08-08T18:32:42Z")

</div>

regular DataFrames.jl will work

```julia
combine(groupby(test_df,"A"), "B" .=> [first,last,mean ∘ skipmissing])

```
