【发布时间】:2016-09-03 11:59:53
【问题描述】:
我在 Julia 中有一个字典
In[27]: CollectedOutputCount
Out[27]: Dict{Any,Any} with 3 entries:
2 => Any[278963,1,1]
3 => Any[283339,1,1]
1 => Any[272878,0,0,0]
我想从字典的内容创建一个数组,该数组由每个字典条目 2:end 的总和组成。每个 Dict 条目中的第一个值是一个标签。输出需要类似于
Output = [ label sum;label sum;...]
在这种情况下是
Output = [278963 2;283339 2;272878 0]
除了在循环中迭代之外,还有其他方法吗?是否有一些功能可以将 Dict 展平为数组(可能在尺寸不均匀的地方使用填充)?
【问题讨论】:
标签: dictionary julia flatten