What's the of all values above some percentile called? How do I get it in pandas? Let's say I have a list of numbers, and I want the mean of all numbers that are greater than the 95th percentile. Is there some standard term for that value? (&quot;Mean of a histogram bin&quot;? &quot;Conditional mean&quot; on something?)
Is there a pandas standard library function to compute it?
I don't think there is a standard library for it.
You can just skip nan value as mean treat them as zero which can mess up the result.
import pandas as pd
df=pd.DataFrame(lst) #For a given list
df[df &gt;= df.quantile(.95)].mean(skipna=True)