Ruby - 如何从多个哈希创建列表

时间:2016-06-17 15:35:06

标签: ruby

我有一堆哈希。我想将它们放入一个列表,我可以访问每个数据点。我的问题是我会使用另一个哈希并为数据点分配密钥或将它们存储到数组中吗?

data_point_a = {:label => "cat", :features => [0.25,0.1,5]}
data_point_b = {:label => "dog", :features => [0.3,0.14,7]}
data_point_c = {:label => "dog", :features => [0.2,0.17,6]}
data_point_d = {:label => "dog", :features => [0.4,0.12,8]}
data_point_e = {:label => "cat", :features => [0.1,0.11,3]}
data_point_f = {:label => "unknown", :features => [0.8,0.3,4]}

0 个答案:

没有答案