On Fri, Apr 2, 2010 at 12:34 PM, Shailendra <shailendra.vi...@gmail.com> wrote:
> 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
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion