I have two arrays A and B as shown below:
A = [[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]
[13 14 15 16]]
B = [3, 11]
Now I need the values in the 4th column of A for rows having values in B and 3rd column of A matching. For this particular case the output array C should be:
C = [4, 12]
I tried this, using the following code, but it returns an empty array:
import numpy as np
A = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])
B = np.array([3, 11])
C = A[np.where(B[:] == A[:][2]), 3]
print(C)