It may not be the most efficient way to do this, but you can do:<br>mask = b > a<br>a[mask] = b[mask]<br><br>-=- Olivier<br><br><div class="gmail_quote">2011/12/6 questions anon <span dir="ltr"><<a href="mailto:questions.anon@gmail.com">questions.anon@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I would like to produce an array with the maximum values out of many (10000s) of arrays.<br>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.<br>

<br>e.g.<br>a=[1,1,2,2<br>11,2,2<br>1,1,2,2]<br>b=[1,1,3,2<br>2,1,0,0<br>1,1,2,0]<br><br>where b>a replace with value in b, so the new a should be :<br><br>a=[1,1,3,2]<br>2,1,2,2<br>1,1,2,2]<br><br>and then keep looping through many arrays and replace whenever value is larger.<br>

<br>I have tried numpy.putmask but that results in <br>TypeError: putmask() argument 1 must be numpy.ndarray, not list<br>Any other ideas? Thanks<br>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br>