[NumPy-Tickets] [NumPy] #2217: 1d array can't be accessed with a tuple.

NumPy Trac numpy-tickets@scipy....
Tue Sep 18 10:24:31 CDT 2012


#2217: 1d array can't be accessed with a tuple.
------------------------+---------------------------------------------------
 Reporter:  laket       |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.1      
 Keywords:              |  
------------------------+---------------------------------------------------
 Using a tuple to access elements of 1d array, I got IndexError,

 {{{
 >>>c = numpy.array([1,2,3])
 >>>c[(0,1)]

 IndexError: invalid index
 }}}

 When I accessed 2d array with a tuple, I got expected result.
 {{{
 >>> c = numpy.array([[1,2],[3,4]])
 >>> c[:,(0,1)]
 array([[1, 2],
        [3, 4]])
 }}}

 Python : 2.7.3
 Numpy : 1.6.1
 OS : Ubuntu 12.04

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2217>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list