You can use transform:
julia> transform(groupby(df, :a), :b=>mean)
5×3 DataFrame
Row │ a b b_mean
│ String Float64 Float64
─────┼──────────────────────────
1 │ 1.0 1.0 1.0
2 │ 2.0 2.0 2.5
3 │ 2.0 3.0 2.5
4 │ 4.0 4.0 4.0
5 │ 5.0 5.0 5.0
See Comparison with Python/R/Stata · DataFrames.jl for a list of common operations like this one.