这个问题已经澄清了。我的答案不再是一个解决方案,而是提供了额外的信息。
使用
key_counts |> collect
而不是
collect(key_counts)
在第二条线上工作,但是
|> collect
在管道末端没有,这感觉像是不想要的行为。
以下回复不再相关
当我运行你的代码时,我确实收到了
Vector{Tuple{Int, Int}}
作为输出。
我使用的是Julia v1.6.0和Query v1.0.0。
using Query
a = [1, 2, 1, 2, 3, 4, 6, 1, 5, 5, 5, 5]
key_counts = a |> @groupby(_) |> @map g -> (key(g), length(values(g)))
output = collect(key_counts)
typeof(output) # Vector{Tuple{Int64, Int64}} (alias for Array{Tuple{Int64, Int64}, 1})