Skip to main content
`Ctrl`+`K`

# pandas.api.typing.DataFrameGroupBy.kurt

DataFrameGroupBy.kurt(skipna=True, numeric_only=False, **kwargs)

  Return unbiased kurtosis within groups.

  Kurtosis obtained using Fisher’s definition (kurtosis of normal == 0.0), normalized by N-1. Values are computed for each numeric column within each group.

  Parameters:
    skipna bool, default True

      Exclude NA/null values when computing the result.

    numeric_only bool, default False

      Include only float, int, boolean columns.

    **kwargs

      Additional keyword arguments to be passed to the function.

  Returns:
    DataFrame

      Unbiased kurtosis within groups.

  See also

  `DataFrame.kurt`

    Return unbiased kurtosis over requested axis.

  Examples

      >>> arrays = [
      ...     [
      ...         "falcon",
      ...         "parrot",
      ...         "cockatoo",
      ...         "kiwi",
      ...         "eagle",
      ...         "lion",
      ...         "monkey",
      ...         "rabbit",
      ...         "dog",
      ...         "wolf",
      ...     ],
      ...     [
      ...         "bird",
      ...         "bird",
      ...         "bird",
      ...         "bird",
      ...         "bird",
      ...         "mammal",
      ...         "mammal",
      ...         "mammal",
      ...         "mammal",
      ...         "mammal",
      ...     ],
      ... ]
      >>> index = pd.MultiIndex.from_arrays(arrays, names=("name", "class"))
      >>> df = pd.DataFrame(
      ...     {
      ...         "max_speed": [
      ...             389.0,
      ...             24.0,
      ...             70.0,
      ...             np.nan,
      ...             350.0,
      ...             80.5,
      ...             21.5,
      ...             15.0,
      ...             40.0,
      ...             50.0,
      ...         ]
      ...     },
      ...     index=index,
      ... )
      >>> df
                       max_speed
      name     class
      falcon   bird        389.0
      parrot   bird         24.0
      cockatoo bird         70.0
      kiwi     bird          NaN
      eagle    bird        350.0
      lion     mammal       80.5
      monkey   mammal       21.5
      rabbit   mammal       15.0
      dog      mammal       40.0
      wolf     mammal       50.0
      >>> gb = df.groupby(["class"])
      >>> gb.kurt()
              max_speed
      class
      bird    -5.493277
      mammal   0.204125
      >>> gb.kurt(skipna=False)
              max_speed
      class
      bird          NaN
      mammal   0.204125