Reputation: 7448
I am wondering whats the best way to find all the indices of a Boolean
array, of which the values are True
. For example, an array of bool
values,
import numpy as np
A = np.array([True, False, True, False, True])
true_list = A[A == True].index.tolist()
Upvotes: 7
Views: 31577