Numpy / pylab min, max
I have two arrays of numbers t, x:
import numpy t = numpy.arange(0,10,0.001) x = numpy.sin(t)
I want to create other arrays of the same size that are staged maximum or minimum:
y1 = ?max(x,2)
y2 = ?min(x,t)
where ?max
and ?min
denote unknown functions. It seems that numpy.max()
and numpy.min()
show max and min entire array of what I do not want to.
How can I achieve this?
source to share
You are looking for numpy.minimum()
and numpy.maximum()
(not to be confused with numpy.min()
and numpy.max()
).
source to share