What is the most efficient method for reducing this array?
data = {
id: [1, 1, 1, 3, 3, 4, 5, 5, 5, ...]
v: [10,10,10, 5, 10 ...]
}
Each id has a corresponding value in v. The goal is to sum up the values of v for each id. Based on the example provided, the desired result would be:
data = {
id: [1, 3, 4, 5, ...]
v: [30, 15, ...]
}