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])
array([[1, 22.7],
[ 1, 55.7],
[ 2, 33.3]])
Here's an approach using np.unique
and np.bincount

unq,ids,count = np.unique(array1,return_inverse=True,return_counts=True)
out = np.column_stack((unq,np.bincount(ids,array2)/count))
Sample run 
In [16]: 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])
...:
In [17]: unq,ids,count = np.unique(array1,return_inverse=True,return_counts=True)
...: out = np.column_stack((unq,np.bincount(ids,array2)/count))
...:
In [18]: out
Out[18]:
array([[ 1. , 22.7 ],
[ 1. , 55.72333333],
[ 2. , 33.28666667]])