Data Science Asked by dankness on December 15, 2020
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? ("Mean of a histogram bin"? "Conditional mean" 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 >= df.quantile(.95)].mean(skipna=True)
Answered by prashant0598 on December 15, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP