[Numpy-discussion] np.var() and ddof

Keith Goodman kwgoodman at gmail.com
Fri Dec 10 16:42:49 EST 2010


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.



More information about the NumPy-Discussion mailing list