I have a list of values which I need to filter given the values in a list of booleans:
list_a = [1, 2, 4, 6] filter = [True, False, True, False]
To do this using numpy, ie, if you have an array, a, instead of list_a:
a
list_a
a = np.array([1, 2, 4, 6]) my_filter = np.array([True, False, True, False], dtype=bool) a[my_filter] > array([1, 4])