[SciPy-user] Numeric array indexing using an array?

Ted Dang tedang at yahoo.com
Thu Aug 11 15:53:36 CDT 2005


Is there an easy way of indexing an array using
another array? (I know this can be done using a for
loop)

Given:
>>> x=arange(10)
>>> y=rand(10)

Want:
>>> z=y(x)
>>> z
array([ 0.90511394,  0.03744266,  0.31686115, 
0.81548136,  0.08736623,  0.58499157,
             0.25363156,  0.84046161,  0.8481133 , 
0.85724437])

============================================

Also, is this how I'm supposed to use this mailing
list? For newbie questions?

============================================

How do I suppress output/print from command line?

Want:
>>> x;
>>>

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

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the SciPy-user mailing list