On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau <span dir="ltr"><<a href="mailto:shish@keba.be" target="_blank">shish@keba.be</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Current behavior looks sensible to me. I personally would prefer no warning but I think it makes sense to have one as it can be helpful to detect issues faster.<br><br>-=- Olivier<br></blockquote><div><br></div><div>It's configurable.</div>


<div><br></div><div><div>[~/]</div><div>[1]: np.seterr(all='ignore')                                                    </div><div>[1]: {'divide': 'ignore', 'invalid': 'ignore', 'over': 'ignore', 'under': 'ignore'}</div>


<div><br></div><div>[~/]</div><div>[2]: np.array([]).mean()                                                        </div><div>[2]: nan</div><div><br></div><div>[~/]</div><div>[3]: np.seterr(all='warn')                                                    </div>


<div>[3]: {'divide': 'ignore', 'invalid': 'ignore', 'over': 'ignore', 'under': 'ignore'}</div><div><br></div><div>[~/]</div><div>[4]: np.array([]).mean()                                                      </div>


<div>/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:57: RuntimeWarning: invalid value encountered in double_scalars</div><div>  ret = ret / float(rcount)</div><div>[4]: nan</div></div><div><br></div><div>Skipper </div>

<div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_quote"><div><div>2012/11/21 Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span><br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>What should be the value of the mean, var, and std of empty arrays? Currently<br><br>
<span style="font-family:courier new,monospace">In [12]: a<br>
Out[12]: array([], dtype=int64)<br><br>In [13]: a.mean()<br>Out[13]: nan<br>
<br>In [14]: a.std()<br>Out[14]: nan<br><br>In [15]: a.var()<br>Out[15]: nan<br><br><font face="arial,helvetica,sans-serif">I think the nan comes from 0/0. All of these also raise warnings the first time they are called.<br>




<br>Chuck<br></font></span><br>
<br></div></div>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">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>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">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>