[SciPy-user] what different between array([ 1., 2., 3.] )

Pierre GM pgmdevlist at gmail.com
Mon Nov 27 21:32:27 CST 2006


On Monday 27 November 2006 22:25, hollowspook at gmail.com wrote:

> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>
> >>> a[4,6]

You try to access a 1D array along two dimensions: that doesn't work.

If you want multiple indices along one dimension, use a list:
>>> a[ [4,6] ]
array([4, 6])

BTW, that's the quickest way to get the edges of your 1D array:
>>>a[[0,-1]]
array([0,9])



More information about the SciPy-user mailing list