Re: [Numpy-discussion] mean of empty sequence gives nan

2010-09-27 Thread Robert Kern
On Mon, Sep 27, 2010 at 17:51, Peter Butterworth wrote: > In numpy 1.5.0, I got the following for mean of an empty sequence (or array): > > In [21]: mean([]) > Warning: invalid value encountered in double_scalars > Out[21]: nan > > Is this behaviour expected ? np.sum([]) / len([]) -> 0.0 / 0 -> n

[Numpy-discussion] mean of empty sequence gives nan

2010-09-27 Thread Peter Butterworth
In numpy 1.5.0, I got the following for mean of an empty sequence (or array): In [21]: mean([]) Warning: invalid value encountered in double_scalars Out[21]: nan Is this behaviour expected ? Also, would it be possible to have more explicit warning messages about the problem being related numpy