Suppose, test_array = np.array([[398, 349],[399, 349],[400, 349],[402, 348],[403 ,348],[405 ,348],[406 ,348],[407 ,348],[408, 347], [409, 347],[412, 347],[413, 347],[414, 347],[415 ,347],[416, 347],[417, 347],[418, 347],[419, 347],[420 ,347],[421 ,348],[422, 348],[423, 348], [424, 348], [425, 348],[426 ,348],[427 ,348],[428, 349],[429, 349],[430, 349],[431 ,349],[432, 350],[433, 350],[434, 350],[435, 351],[436, 351], [437, 351], [438, 352], [439 ,352], [440 ,353], [441 ,354], [442, 355],[443, 356]])
I need to find minimum value on the second column of test_array that is given by:
minv=(test_array[np.argmin(test_array[:, 1])])
Now, I want to find enumerated index of smallest of that minimum value([408,347])
itemindex = np.where(test_array==minv)
this gives tuple list but I need enumerated index of smallest element
when I enumerated array using
for (x,y), value in np.ndenumerate(test_array): print(x,y,value)
Now, computed enumerated index is (8,0) and (8,1), I need to find enumerated index(8). Is there any method to compute this index of smallest element in the array.
https://stackoverflow.com/questions/66575091/how-to-find-enumerated-index-of-numpy-array-in-python March 11, 2021 at 09:06AM
没有评论:
发表评论