[Numpy-discussion] strange behavior of np.minimum and np.maximum

Emmanuelle Gouillart emmanuelle.gouillart at normalesup.org
Wed Apr 6 08:13:09 EDT 2011


Hi Zach and Derek,

thank you very much for your quick and clear answers. Of course the third
parameter is the out array, I was just being very stupid! (I had read the
documentation though, but somehow it didn't make it to my brain :-) Sorry...

> Read the documentation for numpy.minimum and numpy.maximum: they give  
> you element-wise minimum values from two arrays passed as arguments.  
> E.g.:

>  >>> numpy.minimum([1,2,3],[3,2,1])
> array([1, 2, 1])

> The optional third parameter to numpy.minimum is an "out" array - an  
> array to place the results into instead of making a new array for that  
> purpose. (This can save time / memory in various cases.)

Thanks again,
Emmanuelle



More information about the NumPy-Discussion mailing list