How do I select elements of an array given condition? October 20, 2022 by Tarik Your expression works if you add parentheses: >>> y[(1 < x) & (x < 5)] array(['o', 'o', 'a'], dtype="|S1")