[SciPy-user] Array selection help

josef.pktd@gmai... josef.pktd@gmai...
Tue Feb 10 16:17:53 CST 2009

I think this is also similar to a recent thread in scipy-dev. There I
used a dict to build the unique indices. I don't know if this is fast
for your case, since the use case was when there are only a few unique

see thread at: http://projects.scipy.org/pipermail/scipy-dev/2009-January/010900.html


On 2/10/09, Stéfan van der Walt <stefan@sun.ac.za> wrote:
> Hi Jose
> 2009/2/10 Jose Luis Gomez Dans <josegomez@gmx.net>:
>> Let's say I have two 2D arrays, arr1 and arr2. The elements of arr1
>> contain
>> different numbers (such as labels, for example), and the elements of arr2
>> contain some floating point data (say, height above sea level or something
>> like that). For each unique value in arr1, I want to work out the mean
>> (...
>> sum, std dev, etc) of arr2 for the overlapping region. So far, I have used
>> the following code:
> Also take a look at scipy.ndimage, which has functions to calculate
> means and variances over labeled data.
> Cheers
> Stéfan
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-user mailing list