二维数组里面,根据某个一样的元素,其它的元素相加
如何把这样的一个数组,根据数组的"a","b"相同,其它的元素相加,返回一个新的数[
[ "a", 30.0, 27.969999999999999, 0.0 ],
[ "a", 20.0, 20.66, 0.0 ],
[ "b", 160.0, 127.08, 5.0 ],
[ "b", 30.0, 2.0, 1.0 ],
[ "c", 1.0, 0.0, 0.0 ],
[ "a", 10.0, 10.859999999999999, 0.0 ],
[ "b", 8.0, 5.3200000000000003, 1.0 ],
[ "b", 20.0, 9.6500000000000004, 0.0 ],
[ "a", 20.0, 11.300000000000001, 1.0 ],
[ "d", 60.0, 56.609999999999999, 6.0 ],
[ "d", 60.0, 57.340000000000003, 4.0 ],
[ "c", 90.0, 72.420000000000002, 8.0 ],
[ "a", 80.0, 7.9000000000000004, 1.0 ]
]
得到如下一个数组
[
[ "a", 160.0, 78.689999999999998, 2.0 ],
[ "b", 218.0, 144.05000000000001, 7.0 ],
[ "c", 91.0, 72.420000000000002, 8.0 ],
[ "d", 120.0, 113.95, 10.0 ]
]