How do I calculate percentiles with python/numpy?
问题 Is there a convenient way to calculate percentiles for a sequence or single-dimensional numpy array? I am looking for something similar to Excel's percentile function. I looked in NumPy's statistics reference, and couldn't find this. All I could find is the median (50th percentile), but not something more specific. 回答1: You might be interested in the SciPy Stats package. It has the percentile function you're after and many other statistical goodies. percentile() is available in numpy too.