>>> matrix = np.asarray([1, 0, 0, 1, 0, 0, 1, 0, 1]) >>> np.where(matrix == 1) (array([0, 3, 6, 8], dtype=int64),)