I decided to compare skew and kurtosis functions in pandas and scipy.stats, and don\'t understand why I\'m getting different results between libraries.
As far as I can t
The difference is due to different normalizations. Scipy by default does not correct for bias, whereas pandas does.
You can tell scipy to correct for bias by passing the bias=False
argument:
>>> x = pandas.Series(np.random.randn(10))
>>> stats.skew(x)
-0.17644348972413657
>>> x.skew()
-0.20923623968879457
>>> stats.skew(x, bias=False)
-0.2092362396887948
>>> stats.kurtosis(x)
0.6362620964462327
>>> x.kurtosis()
2.0891062062174464
>>> stats.kurtosis(x, bias=False)
2.089106206217446
There does not appear to be a way to tell pandas to remove the bias correction.