If you want to use multiple conditions in the where() function of Numpy, you need to put those conditions inside the parentheses "()," and instead of using and/or, you need to use &/|.
& is AND
| is OR
Here is an example to show how to use multiple conditions in the Numpy where() function.
>>> import numpy as np>>> a=np.array([12,14,16,18,7,8,45,23,34])>>> aarray([12, 14, 16, 18, 7, 8, 45, 23, 34])>>> np.where((a>10) & (a<20))(array([0, 1, 2, 3]),)>>> a[np.where((a>10) & (a<20))[0]]array([12, 14, 16, 18])