Seems like you want to group by curveLocations
and get the aggregation of distinctCrossings
as sum.
import numpy as np
arrayCurveLocations = [
[1, 3],
[2, 5],
[1, 7],
[3, 2],
[2, 6]
]
arrayCurveLocations = np.array(arrayCurveLocations)
If you want below as result:
[
[1, 10],
[2, 11],
[3, 2]
]
Then I can show how it can be done with pandas.
import pandas as pd
df = pd.DataFrame(arrayCurveLocations, columns=['curveLocations', 'distinctCrossings'])
result = df.groupby('curveLocations', as_index=False)['distinctCrossings'].sum()
result_array = result.values
print(result_array)
If you want to rely on only numpy to solve your problem, then this Link could help.