[Numpy-discussion] Replacing values based on index

Pinner, Luke Luke.Pinner at environment.gov.au
Thu Aug 12 01:52:43 EDT 2010


Simple as that...
Thanks!

-----Original Message-----
From: numpy-discussion-bounces at scipy.org
[mailto:numpy-discussion-bounces at scipy.org] 
      On Behalf Of Geordie McBain

Convert days to np.array, then you can index it with your indexmin:

days = [10, 20, 31, 41, 51, 59, 69, 79, 90, 100]
mydays = np.array (days)
indexmin=np.array([[0, 2, 1],
                  [6, 7, 3],
                  [5, 5, 8]])
print mydays[indexmin]

=>

[[10 31 20]
 [69 79 41]
 [59 59 90]]
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion at scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


------
If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments. 



Please consider the environment before printing this email.

------




More information about the NumPy-Discussion mailing list