如何經過numpy得到二維或多維數組的最大、小值索引

雖然numpy數組中有argmax的函數能夠得到數組的最大值的索引,但該函數得到的是numpy數組平鋪後的索引,也就是一維索引。那麼要怎樣才能得到二維索引呢?實現很簡單,好比我下面的代碼:html import numpy as np import math a = np.array([[1, 2, 3], [4, 5, 6]]) m, n = a.shape inde
相關文章
相關標籤/搜索