[Numpy-discussion] array indexing question

Neal Becker ndbecker2 at gmail.com
Tue Oct 14 15:36:48 EDT 2014


I'm using np.nonzero to construct the tuple:
(array([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]), array([1, 3, 5, 7, 2, 3, 6, 7, 4, 
5, 6, 7]))

Now what I want is the 2-D index array:

[1,3,5,7,
2,3,6,7,
4,5,6,7]

Any ideas?

-- 
-- Those who don't understand recursion are doomed to repeat it




More information about the NumPy-Discussion mailing list