
May 3, 2009
8 p.m.
2009/5/3 <josef.pktd@gmail.com>:
factors = np.random.randint(5,size=(4,3)) factors array([[1, 1, 3], [0, 2, 1], [4, 4, 1], [2, 2, 4]]) factors.max() 4 np.argmax(factors) 6 np.nonzero(factors==factors.max()) (array([2, 2, 3]), array([0, 1, 2]))
Since you have more than one maximum here, you have to do something like Josef outlined above. If you only want the indices of the first maximum argument, you can use np.unravel_index(6, factors.shape) Regards Stéfan