I have a numpy array based around this format [[x,y],[x,y]...]
and with this I would like to combine the y
values where the x
's are the same
Example array = [[0,0],[1,1],[2,4],[4,6],[2,2],[3,7],[1,9],[4,16],[5,1],[5,2],[0,0]]
I would like this to become newArray = [[0,0],[1,10],[2,6],[3,7],[4,22],[5,3]]
- it doesn't have to be ordered
As if now i can't think of a way to do this simply and efficiently, it might help to add in my actual array uses timestamps as my x
value such as Timestamp('2018-05-05 00:00:00')
and is 183083 in size which isn't too bad.
Any help appricated!