[SciPy-user] Array selection help

Stéfan van der Walt stefan@sun.ac...
Tue Feb 10 16:14:31 CST 2009

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.


More information about the SciPy-user mailing list