-
Hello! I'm trying to do some pretty basic slicing to find values in column 3 where the value in column one is between nmin and nmax. In numpy you can do this: However is ulab I get the error: I saw in the documentation that you may get a not implemented error for trying to slice more than a 1D vector. Is this still the case? And is there a sneaky way around this? I have my own sneaky way that looks like this: But the set functions are very slow and are bad for my application. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I believe I have an answer based on a bug report from this repo. You can do this using np.where: import ulab.numpy as np Then in the d array you have converted all invalid rows to nan's, Now you can repeat the process on d using the next boolean operation on the other column of interest and you're left with only valid data. |
Beta Was this translation helpful? Give feedback.
I believe I have an answer based on a bug report from this repo.
You can do this using np.where:
import ulab.numpy as np
a=np.array([[1,2,3],[2,3,4],[5,6,7]])
b=a[:,1]==3
c=b.reshape((len(b),1))
d=np.where(c,a,np.nan)
Then in the d array you have converted all invalid rows to nan's, Now you can repeat the process on d using the next boolean operation on the other column of interest and you're left with only valid data.