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).
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-09-20 11:00:00 +0000
Seen: 7 times
Last updated: Feb 23 '23