Suppose I have a 2D array as follows with two columns, and a few rows. Let's call the first column x, and the second one y
x y
17 1
26 0
45 1
66 1
87 1
95 1
111 0
117 1
472 0
473 1
17 1
For x elements that are repated, I want to add up their corresponding values together, so instead of having two rows with
17 1
17 1,
I want just one row with 17 2.
Is there an easy way to do this. I would also like to get rid of all rows that have a 0 in the y column.
Thank you