如何查找範圍之間的數字?Python:numpy數組大小,小於值
c = array[2,3,4,5,6]
>>> c>3
>>> array([False, False, True, True, True]
然而,當我得到C,在兩個數字之間,它返回錯誤
>>> 2<c<5
>>> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
的願望輸出
array([False, True, True, False, False]
[numpy的陣列合成邏輯語句和在]的可能的複製(http://stackoverflow.com/questions/21996661/combining-logic-statements-and-in -numpy-array) – Moberg