2016-08-22 80 views

回答

1
import numpy as np 

mat = np.array([[2,3,2], [7,7,6], [2,7,3]]) 
print(mat) 

max_indices = np.where(mat == np.amax(mat)) 
print(max_indices) 

index_max = mat[max_indices] 
print(index_max) 

輸出:

[[2 3 2] 
[7 7 6] 
[2 7 3]] 
(array([1, 1, 2]), array([0, 1, 1])) # first array: x-axis, second: y-axis 
[7 7 7]