0

Is there a natural way in a numpy array, to aggregate rows that have same 1st column value? i.e. such that:

A = numpy.array([[1, 2], [1, 7], [2, 14], [3, -1], [3, 6]])

#[[ 1  2]
# [ 1  7]
# [ 2 14]
# [ 3 -1]
# [ 3  6]]

would give

[[ 1  9]
 [ 2 14]
 [ 3  5]
Basj
  • 41,386
  • 99
  • 383
  • 673

0 Answers0