[SciPy-user] Vector indexing

David Grant david.grant at telus.net
Sun Jun 4 19:34:06 EDT 2006


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?

Thanks,
David




More information about the SciPy-User mailing list