Skip to main content
`Ctrl`+`K`

# pandas.api.typing.Rolling.kurt

Rolling.kurt(numeric_only=False)

  Calculate the rolling Fisher’s definition of kurtosis without bias.

  This is equivalent to applying `scipy.stats.kurtosis` (with `bias=False`) over each rolling window. A minimum of four periods is required.

  Parameters:
    numeric_only bool, default False

      Include only float, int, boolean columns.

  Returns:
    Series or DataFrame

      Return type is the same as the original object with `np.float64` dtype.

  See also

  `scipy.stats.kurtosis`

    Reference SciPy method.

  `Series.rolling`

    Calling rolling with Series data.

  `DataFrame.rolling`

    Calling rolling with DataFrames.

  `Series.kurt`

    Aggregating kurt for Series.

  `DataFrame.kurt`

    Aggregating kurt for DataFrame.

  Notes

  A minimum of four periods is required for the calculation.

  Examples

  The example below will show a rolling 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[1:], bias=False):.6f}")
      3.999946
      >>> s = pd.Series(arr)
      >>> s.rolling(4).kurt()
      0         NaN
      1         NaN
      2         NaN
      3   -1.200000
      4    3.999946
      dtype: float64