On Tue, Jul 9, 2013 at 2:55 PM, Chao YUE <[email protected]> wrote: > I am using 1.7.1 version of numpy and np.ma.argmax is not repecting the > mask? > > In [96]: d3 > Out[96]: > masked_array(data = > [[-- -- -- -- 4] > [5 -- 7 8 9]], > mask = > [[ True True True True False] > [False True False False False]], > fill_value = 6) > > > In [97]: np.ma.argmax(d3,axis=0) > Out[97]: array([1, 0, 1, 1, 1])
This is the result I would expect. If both values are masked, the fill value is used, so there is always an argmin value. The following workaround should have done the trick, but it exposes a different bug: x = np.ma.array([[0,1,2,3,4],[5,6,7,8, 9]], mask=[[1, 1, 1, 1, 0], [0, 1, 0, 0 ,0]], dtype=float) np.nanargmax(x.filled(np.nan), axis=0) This breaks with "ValueError: cannot convert float NaN to integer" Stéfan _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
