I want to compare multiple arrays which are defined in the values of a dictionary. I want to compare every element within all arrays to find the lowest value for this element. The key of the array corresponding to the lowest element should be mapped into a new array (or list) as such:
img_dictionary = {0: np.array([[935, 925, 271, 770, 869, 293],
[125, 385, 291, 677, 770, 770]], dtype=uint64),
1: np.array([[ 12, 92, 28, 942, 124, 882],
[241, 853, 292, 532, 834, 231]], dtype=uint64),
2: np.array([[934, 633, 902, 912, 922, 812],
[152, 293, 284, 634, 823, 326]], dtype=uint64),
3: np.array([[362, 11, 292, 48, 92, 481],
[196, 294, 446, 591, 92, 591]], dtype=uint64)}
Expected outcome
(array([[1, 3, 1, 3, 3, 0],
[0, 2, 2, 1, 3, 1]], dtype=uint64),)
I have tried to use np.minimum() and functions alike, but these do not allow for the comparison of multiple arrays.
np.array. It will work asarrayif you import NumPy withfrom numpy import *...