python Method for Calculating Data Deviation and Kurtosis

  • 2021-07-06 11:12:25
  • OfStack

numpy.set_printtoptions (edgeitems=5): Too many values, showing the first 5 and last 5

Skewness: Measure the imbalance of random distribution, skewness = 0, and the value is relatively evenly distributed on both sides

Kurtosis: The characteristic of the peak value of probability density at the mean value

python calculates data mean, standard deviation, skewness, kurtosis:


import numpy as np
from scipy import stats
 
x = np.random.randn(10000)
mu = np.mean(x, axis=0)
sigma = np.std(x, axis=0)
skew = stats.skew(x)
kurtosis = stats.kurtosis(x)
 

Related articles: