Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The pandas Series equivalent of the quantile function's inverse is the quantile() function itself. It takes a probability value as input and returns the corresponding value in the Series that lies at or below that probability. For example:

import pandas as pd

# create a Series of numbers
s = pd.Series([1, 2, 3, 4, 5])

# find the value at or below the 75th percentile
q = s.quantile(0.75)

In this example, q would equal 4, as 4 is the value in the Series that lies at or below the 75th percentile (which is 3.75).