[Numpy-discussion] loop through values in a array and find maximum as looping
shish at keba.be
Tue Dec 6 19:55:43 EST 2011
It may not be the most efficient way to do this, but you can do:
mask = b > a
a[mask] = b[mask]
2011/12/6 questions anon <questions.anon at gmail.com>
> I would like to produce an array with the maximum values out of many
> (10000s) of arrays.
> I need to loop through many multidimentional arrays and if a value is
> larger (in the same place as the previous array) then I would like that
> value to replace it.
> where b>a replace with value in b, so the new a should be :
> and then keep looping through many arrays and replace whenever value is
> I have tried numpy.putmask but that results in
> TypeError: putmask() argument 1 must be numpy.ndarray, not list
> Any other ideas? Thanks
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion