Hell i have nonsense values of variance and standart deviation in numpy.
this documentation no make sense with this sample. https://numpy.org/doc/stable/reference/generated/numpy.std.html
youtube example calculation mean:9, var:9
>>> import numpy as np
>>> a=np.array([6,9,14,10,5,8,1])
>>> np.mean(a)
7.571428571428571
>>> np.var(a)
14.530612244897958
>>> np.std(a)
3.8119040183218096
>>> np.nanvar(a)
14.530612244897958
edit for youtubeissues:
a=np.array([5,6,8,9,10,11,14])
>>> np.var(a) 8.0
edit for a smaller sample for apply the variance equation a=2,3,4,5 mean=3.5
var=((2-3.5)**2+(2-3.5)**2+(3-3.5)**2+(4-3.5)**2+(5-3.5)**2) / 3 = 2.4166666666666665
>>> a=np.array([2,3,4,5])
>>> np.var(a)
1.25
>>> np.mean(a)
3.5
>>> np.std(a)
1.118033988749895
How i fix this value of variance? what is the problem with numpy?