1# Calculate standard deviaton based on population/sample
2import numpy as np
3values = [1,5,4,3,3,4]
4# as default, std() calculates basesd on a population
5# by specifying ddof=1, it calculates based on the sample
6np.std(values) # ==1.247219128924647
7np.std(values ,ddof=1) # ==1.3662601021279464
1import numpy as np
2data = [68,86,36,57,24,46,32,53] #define some data
3data_std = np.std(data) #outputs 19.00493356999703
1import numpy
2numbers = [1,5,6,7,9,11,13]
3standard = numpy.std(numbers) #Calculates standard deviation
4print(standard)
1import numpy as np
2values=[1,10,100]
3print(np.std(values))
4values=[1,10,100,np.nan]
5print(np.nanstd(values))