[Numpy-discussion] the mean, var, std of empty arrays

Charles R Harris charlesr.harris at gmail.com
Wed Nov 21 20:51:50 EST 2012

What should be the value of the mean, var, and std of empty arrays?

In [12]: a
Out[12]: array([], dtype=int64)

In [13]: a.mean()
Out[13]: nan

In [14]: a.std()
Out[14]: nan

In [15]: a.var()
Out[15]: nan

I think the nan comes from 0/0. All of these also raise warnings the first
time they are called.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20121121/b92478dd/attachment.html>

More information about the NumPy-Discussion mailing list