[SciPy-user] Array selection help

Stéfan van der Walt stefan@sun.ac...
Wed Feb 11 14:08:03 CST 2009


2009/2/11 Stéfan van der Walt <stefan@sun.ac.za>:
> In [55]: means[[1,1,0,1,0,0]]
> Out[55]: array([ 0.2,  0.2,  0.1,  0.2,  0.1,  0.1])
>
> I implemented a solution using such a "translation table" (see attached).

Note that, for this approach to work, the labels must progress in
increments of one from 0 to N.  So labels 0, 1, 2, 3 are fine, but 0,
5, 10 are not.

Cheers
Stéfan


More information about the SciPy-user mailing list