[SciPy-user] element-by-element max of two arrays?

Alan G Isaac aisaac at american.edu
Tue Jun 20 14:13:27 CDT 2006


On Tue, 20 Jun 2006, (UTC) Grant Edwards apparently wrote: 
> How do I get an element-by-element max or min of two 
> arrays?  For two NxM arrays A and B, I want an NxM array 
> C where 
>    C[i,j] == max(A[i,j],B[i,j]) 


x = rand(5,10)
y = rand(5,10)
z = array([x,y])
zmax = z.max(axis=0)

hth,
Alan Isaac





More information about the SciPy-user mailing list