In [2]: import numpy as np In [4]: test_array = np.array([1, 4, 0, 2, 3, 8, 9, 7], float) test_array > 3 Out[4]: array([False, True, False, False, False, True, True, True]) In [6]: test_array[test_array>3] Out[6]: array([4., 8., 9., 7.]) In [8]: condition = test_array < 3 test_array[condition] Out[8]: array([1., 0., 2.]) In [10]: A = np.array([ [12, 13, 14, 12, 16, 14, 11, 10, 9], [11, 14, 12, 1..