I have a numpy array like so:
arr = np.array([[[0,0],[93]],[[2,8],[94]]])
I now want to define two variables a and b like so:
a = 2
b = 8
Now, I want to write a program that retrieves the value corresponding to [a,b] from the numpy array. In this case, the value would be 94.
How do I solve this? I am open to other ways of organizing my data as well (lists, dictionaries etc) as long as the solution is optimal. However, I want to preserve the current format of an entry in the array viz., ([inp,inp],[out])
So far, I have tried using np.where but it returns an empty array:
np.where(arr == [2,8])
>>> (array([], dtype=int64), array([], dtype=int64))
user24644752 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.