Re: [SciPy-user] what different between array([ 1., 2., 3.])
by hollowspook other posts by this author
Nov 27 2006 8:00PM messages near this date
Re: [SciPy-user] problem with lsim
|
Re: [SciPy-user] what different between array([ 1., 2., 3.] )
Hi,
I just think about another silimar problem.
The code is here:
-------------------------------------
> >> a = array(range(10))
> >> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
> >> a[4,6]
Traceback (most recent call last):
File "<interactive input> ", line 1, in ?
IndexError: invalid index
> >> a.shape = 1,10
> >> a
array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
> >> a[0,[4,6]]
array([4, 6])
> >> a[:,[4,6]]
array([[4, 6]])
-------------------------------------------
If I only want to index No 4 and No 6 in a 1-D array a. Using a[4,6] is
obviously wrong.
Under this situation, do I have to shape it to a 2-D 1-by-10 array as
shown above?
Then use a[0,[4,6]] to index them?
_______________________________________________
SciPy-user mailing list
SciPy-user@[...].org
http://projects.scipy.org/mailman/listinfo/scipy-user
|