pandas.core.window.expanding.Expanding.kurt

Expanding.kurt(**kwargs)[source]

Calculate unbiased expanding kurtosis.

This function uses Fisher’s definition of kurtosis without bias.

Parameters
**kwargs

Under Review.

Returns
Series or DataFrame

Returned object type is determined by the caller of the expanding calculation.

See also

pandas.Series.expanding

Calling object with Series data.

pandas.DataFrame.expanding

Calling object with DataFrames.

pandas.Series.kurt

Equivalent method for Series.

pandas.DataFrame.kurt

Equivalent method for DataFrame.

scipy.stats.skew

Third moment of a probability density.

scipy.stats.kurtosis

Reference SciPy method.

Notes

A minimum of 4 periods is required for the expanding calculation.

Examples

The example below will show an expanding calculation with a window size of four matching the equivalent function call using scipy.stats.

>>> arr = [1, 2, 3, 4, 999]
>>> import scipy.stats
>>> print(f"{scipy.stats.kurtosis(arr[:-1], bias=False):.6f}")
-1.200000
>>> print(f"{scipy.stats.kurtosis(arr, bias=False):.6f}")
4.999874
>>> s = pd.Series(arr)
>>> s.expanding(4).kurt()
0         NaN
1         NaN
2         NaN
3   -1.200000
4    4.999874
dtype: float64