I have a matrix like: [[ 4 5 6 ] [ 1 2 3 ] [ 7 8 9 ]]
and need the mean value of every row (5, 2, 8). The problem comes when I need to sort by the mean value of every row and print it alongside with original index of the row whose mean value I'm printing.
The output should first show the index and then the mean value like this: [2:2, 1:5, 3:8]
So far I have this without any idea how to ad index to it...
average = []
for i in range(m):
k = numpy.mean(A[i])
average.append(k)
average.sort()
print(average)