[SciPy-user] Vector indexing

Robert Kern robert.kern at gmail.com
Sun Jun 4 20:18:57 EDT 2006


David Grant wrote:
> Vector indexing question:
> 
> a=rand(10,10)
> 
> 1) a[0:3, 0:3] #gives me the first 3 rows and columns
> 
> 2) a[range(2),range(2)] gives me a one-dimensional array of elements [0,0], 
> [1,1], [2,2]
> 
> How do I do 1) using some on-the-fly generated array?

Never mind. Simon has what you want.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the SciPy-User mailing list