I have these numpy arrays:
array1 = np.array([-1, -1, 1, 1, 2, 1, 2, 2])
array2 = np.array([34.2, 11.2, 22.1, 78.2, 55.0, 66.87, 33.3, 11.56])
Now I want to return a 2d array in which there is the mean for each distinctive value from array1 so my output would look something like this:
array([[-1, 22.7],
[ 1, 55.7],
[ 2, 33.3]])
Is there an efficient way without concatenating those 1D arrays to one 2D array? Thanks!