[Numpy-discussion] Understanding np.min behaviour with nan

2018-01-10 Thread Andrew Nelson
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 Run

Re: [Numpy-discussion] Understanding np.min behaviour with nan

2018-01-10 Thread Andrew Nelson
Further to my last message, why is the warning only raised once? ``` >>> 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,

Re: [Numpy-discussion] Understanding np.min behaviour with nan

2018-01-10 Thread Robert Kern
On Wed, Jan 10, 2018 at 3:03 PM, Andrew Nelson wrote: > > Further to my last message, why is the warning only raised once? > > ``` > >>> 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

Re: [Numpy-discussion] Understanding np.min behaviour with nan

2018-01-10 Thread Gerrit Holl
On 10 January 2018 at 23:03, Andrew Nelson wrote: > Further to my last message, why is the warning only raised once? Warnings are only raised once because that is the default behaviour for warnings. The warning is issued every time but only displayed on the first occurence. You can control this

Re: [Numpy-discussion] Understanding np.min behaviour with nan

2018-01-10 Thread Andrew Nelson
> The same warning would have been issued from the same place in each of the variations you tried. That's not the case, I tried with np.min([1, 2, 3, np.nan]) in a fresh interpreter and no warning was raised. Furthermore on my work computer (conda python3.6.2 with pip installed numpy) I can't get