I'm having some trouble understanding the behaviour of np.min when used
with NaN. In the documentation of np.amin it says: "NaN values are
propagated, that is if at least one item is NaN, the corresponding min
value will be NaN as well. ". It doesn't say that in some circumstances
there will be RuntimeWarning's raised (presumably depending on the
errstate). Consider the following:
>>> import numpy as np
>>> np.min([1, np.nan])
/Users/andrew/miniconda3/envs/dev3/lib/python3.6/site-packages/numpy/core/_methods.py:29:
RuntimeWarning: invalid value encountered in reduce
return umr_minimum(a, axis, None, out, keepdims)
nan
>>> np.min([1, 2, np.nan])
nan
>>> np.min([np.nan, 1, 2])
nan
>>> np.min([np.nan, 1])
nan
Why is there a RuntimeWarning for the first example, but not the others? Is
this expected behaviour?
--
_____________________________________
Dr. Andrew Nelson
_____________________________________