title: How to correctly use scipy's skew and kurtosis functions?
body: <p>The <em>skewness</em> is a parameter to measure the symmetry of a data set and the <em>kurtosis</em> to measure how heavy its tails are compared to a normal distribution, see for example <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm" rel="noreferrer">here</a>.</p>
  <p><code>scipy.stats</code> provides an easy way to calculate these two quantities, see <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kurtosis.html#scipy.stats.kurtosis" rel="noreferrer"><code>scipy.stats.kurtosis</code></a> and <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.skew.html#scipy.stats.skew" rel="noreferrer"><code>scipy.stats.skew</code></a>.</p>
  <p>In my understanding, the skewness and kurtosis of a <a href="https://en.wikipedia.org/wiki/Normal_distribution" rel="noreferrer">normal distribution</a> should both be 0 using the functions just mentioned. That is, however, not the case with my code:</p>
  <pre><code>import numpy as np
  from scipy.stats import kurtosis
  from scipy.stats import skew
  
  x = np.linspace( -5, 5, 1000 )
  y = 1./(np.sqrt(2.*np.pi)) * np.exp( -.5*(x)**2  )  # normal distribution
  
  print( 'excess kurtosis of normal distribution (should be 0): {}'.format( kurtosis(y) ))
  print( 'skewness of normal distribution (should be 0): {}'.format( skew(y) ))
  </code></pre>
  <p>The output is:</p>
  <blockquote>
  <p>excess kurtosis of normal distribution (should be 0): -0.307393087742</p>
  <p>skewness of normal distribution (should be 0): 1.11082371392</p>
  </blockquote>
  <p>What am I doing wrong ?</p>
  <p>The versions I am using are</p>
  <pre><code>python: 2.7.6
  scipy : 0.17.1
  numpy : 1.12.1
  </code></pre>