[Numpy-discussion] permutation and array subsets
Scott Ransom
ransom at cfa.harvard.edu
Wed Aug 8 00:46:41 EDT 2001
Serge Rey wrote:
>
> i'm trying to use the results of permutation (from RandomArray.py) to
> reorder the rows of an array:
>
> >>> r=arange(20)
> >>> id=permutation(20)
> >>> y=r[id]
Try:
y = take(r, permutation(len(r)))
Scott
--
Scott M. Ransom Address: Harvard-Smithsonian CfA
Phone: (617) 496-7908 60 Garden St. MS 10
email: ransom at cfa.harvard.edu Cambridge, MA 02138
GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989
More information about the NumPy-Discussion
mailing list