April 2, 2010
4:34 p.m.
Hi All,
x=arange(10) indices=[(1,),(2,)] x[indices] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: unsupported iterator index
But following works.
x=x.reshape(5,2) x array([[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]) indices=[(1,0),(0,1)] x[indices] array([2, 1])
Should not the first one also work? How to convert [(1,),(2,)] to [1,2] efficiently. Thanks, Shailendra