argmin of empty masked sequence not correctly handled (returns 0)
5 Jan
2024
5 Jan
'24
7:58 p.m.
argmin of an empty sequence throws an exception, which I think is a good thing: np.argmin([]) --------------------------------------------------------------------------- ValueError But not for a masked array: n [24]: u = np.arange (10) In [25]: v = np.ma.array (u, mask=np.ones(10)) In [26]: v Out[26]: masked_array(data=[--, --, --, --, --, --, --, --, --, --], mask=[ True, True, True, True, True, True, True, True, True, True], fill_value=999999, dtype=int64) In [28]: np.argmin(v) Out[28]: 0 This is error prone and inconsistent.
284
Age (days ago)
284
Last active (days ago)
0 comments
1 participants
participants (1)
-
Neal Becker