This is a simple test
import numpy as np
data = np.array([-1,0,1])
print data.std()
>> 0.816496580928
I don\'t understand how this r
The crux of this problem is that you need to divide by N (3), not N-1 (2). As Iarsmans pointed out, numpy will use the population variance, not the sample variance.
So the real answer is sqrt(2/3) which is exactly that: 0.8164965...
If you happen to be trying to deliberately use a different value (than the default of 0) for the degrees of freedom, use the keyword argument ddofwith a positive value other than 0:
np.std(data, ddof=1)
... but doing so here would reintroduce your original problem as numpy will divide by N - ddof.