sthoooon
2/8/2016 - 5:48 PM

Simple Statistics

Simple Statistics

c = np.loadtxt('data.csv', delimiter=',', usecols=(6,),unpack=True)
print "Median =", np.median(c) #Median
sorted_close = np.msort(c) #Sorting
print "Sorted =", sorted_close
N = len(c)
print "Middle =", sorted_close[(N-1)/2] #Same as median
print "Variance =", np.var(c) #Variance
print "Variance from definition =", np.mean((c - c.mean())**2) #Same as variance