[Numpy-discussion] the mean, var, std of empty arrays
Charles R Harris
Wed Nov 21 21:35:39 CST 2012
On Wed, Nov 21, 2012 at 7:45 PM, <email@example.com> wrote:
> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau <firstname.lastname@example.org> wrote:
> > Current behavior looks sensible to me. I personally would prefer no
> > but I think it makes sense to have one as it can be helpful to detect
> > faster.
> I agree that nan should be the correct answer.
> (I gave up trying to define a default for 0/0 in scipy.stats ttests.)
> some funnier cases
> >>> np.var(, ddof=1)
This one is a nan in development.
> >>> np.var(, ddof=5)
> >>> np.var([1,2], ddof=5)
> >>> np.std([1,2], ddof=5)
These still do this. Also
In : var(, ddof=1)
Which suggests that the nan is pretty much an accidental byproduct of
division by zero. I think it might make sense to have a definite policy for
these corner cases.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion