[Numpy-discussion] np.var() and ddof
Keith Goodman
kwgoodman@gmail....
Fri Dec 10 16:32:24 CST 2010
On Fri, Dec 10, 2010 at 2:26 PM, <josef.pktd@gmail.com> wrote:
> On Fri, Dec 10, 2010 at 4:42 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
>> Why does ddof=2 and ddof=3 give the same result?
>>
>>>> np.var([1, 2, 3], ddof=0)
>> 0.66666666666666663
>>>> np.var([1, 2, 3], ddof=1)
>> 1.0
>>>> np.var([1, 2, 3], ddof=2)
>> 2.0
>>>> np.var([1, 2, 3], ddof=3)
>> 2.0
>>>> np.var([1, 2, 3], ddof=4)
>> -2.0
>>
>> I expected NaN for ddof=3.
>
> It's a floating point calculation, so I would expect np.inf
Right, NAFN (F=Finite). Unless, of course, the numerator is zero too.
More information about the NumPy-Discussion
mailing list