import numpy as np
a=np.array([[4,2,6],[3,6,5]])
b=np.array([3,5])
I want to update the numbers in "a" which are bigger than the numbers in "b" to np.nan. If they are smaller or equal i don't want it to be changed. I want to compare the first row of "a" to the first scalar of "b" and the second row of "a" to the second scalar of "b".
e.g.
a = array([[4, 2, 6],[3, 6, 5]])
the updated value should be:
array([[nan, 2, nan],[3, nan, 5]])
I've tried this:
for i in range(2):a[i]=np.where(a[i]<=b[i],a[i],np.nan)
But it doesn't work. HELP ME PLEASE!!