Skip to main content
`Ctrl`+`K`

# pandas.api.typing.SeriesGroupBy.quantile

SeriesGroupBy.quantile(q=0.5, interpolation='linear', numeric_only=False)

  Return group values at the given quantile, a la numpy.percentile.

  This method returns the value at the given quantile for each group, using the specified interpolation method when the desired quantile falls between two data points.

  Parameters:
    q float or array-like, default 0.5 (50% quantile)

      Value(s) between 0 and 1 providing the quantile(s) to compute.

    interpolation{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}

      Method to use when the desired quantile falls between two points.

    numeric_only bool, default False

      Include only float, int or boolean data.

      Changed in version 2.0.0: numeric_only now defaults to `False`.

  Returns:
    Series or DataFrame

      Return type determined by caller of GroupBy object.

  See also

  `Series.quantile`

    Similar method for Series.

  `DataFrame.quantile`

    Similar method for DataFrame.

  `numpy.percentile`

    NumPy method to compute qth percentile.

  Examples

      >>> df = pd.DataFrame(
      ...     [["a", 1], ["a", 2], ["a", 3], ["b", 1], ["b", 3], ["b", 5]],
      ...     columns=["key", "val"],
      ... )
      >>> df.groupby("key").quantile()
          val
      key
      a    2.0
      b    3.0