pandas.DataFrame.quantile

pandas 3.1.1 · DataFrame · method

Estimate the value at a specified fraction of the sorted distribution.

Call syntax

DataFrame.quantile(q=0.5, axis=0, numeric_only=False, interpolation='linear', method='single')

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
q Optional
Positional or keyword
Default 0.5
float or array-like

Provide quantiles as fractions between 0 and 1, or a number of quantile bins for qcut.

axis Optional
Positional or keyword
Default 0
{0 or 'index', 1 or 'columns'}

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

numeric_only Optional
Positional or keyword
Default False
bool

Restrict the calculation to columns pandas considers numeric where applicable.

interpolation Optional
Positional or keyword
Default 'linear'
{'linear', 'lower', 'higher', 'midpoint', 'nearest'}

Choose how to compute results that fall between observed values.

method Optional
Positional or keyword
Default 'single'
{'single', 'table'}

Choose the algorithm used to calculate, align, or fill the result.

Returns

Series or DataFrame