On Wed, Nov 21, 2012 at 7:45 PM, <[email protected]> wrote:

> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau <[email protected]> wrote:
> > 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.
>
> 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([1], ddof=1)
> 0.0
>

This one is a nan in development.


> >>> np.var([1], ddof=5)
> -0
> >>> np.var([1,2], ddof=5)
> -0.16666666666666666
> >>> np.std([1,2], ddof=5)
> nan
>
>
These still do this. Also

In [10]: var([], ddof=1)
Out[10]: -0

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.

<snip>

Chuck
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to