Percentiles: Analyzing Data with NumPy

Use NumPy's percentile method to calculate the percentage of data values below a given number in a dataset.

Gain clarity on percentiles and their practical significance in data analysis. Learn how NumPy simplifies percentile calculations to efficiently interpret data distributions.

Key Insights

  • Percentile indicates the percentage of values in a dataset that fall below a certain value, making it a useful measure for understanding data distribution.
  • NumPy provides a straightforward method for calculating percentiles: the percentile method, which easily computes percentile values from a set of numerical data.
  • The example demonstrates the calculation of the 75th and 25th percentiles, which indicate that 75% of the sample degrees are below 90.5 and 25% are below 71.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

Let's talk about percentile. Percentile is a fairly simple measurement. It's the percent of values in a collection that are lower than a given number.

If we want to calculate, give me the number that most degrees are less than, 75%. We could say NumPy, NumPy has our back on this. NumPy has a percentile method.

And when you pass the list that we want it to analyze and give it a percentile number. Let's set that to a variable. Percentile 75.

Makes sense to me. And print it. I run that 90.5. So that means in our degrees, let's just take a look at our degrees again.

We can remember what these values are. Okay, 75% of them are below 90.5. So 91 or lower, or sorry, 89 or lower. Nope, 90 or lower.

Data Analytics Certificate: Live & Hands-on, In NYC or Online, 0% Financing, 1-on-1 Mentoring, Free Retake, Job Prep. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

There we go. So 25% of them are above there. So how about the 25th percentile? Ones that are below that value.

We can take a look at the same measurement degrees, 25. Percentiles are very useful when you're trying to understand a dataset. What is the general distribution of it? So 71, 75% of them are under 71.

Colin Jaffe

Colin Jaffe is a programmer, writer, and teacher with a passion for creative code, customizable computing environments, and simple puns. He loves teaching code, from the fundamentals of algorithmic thinking to the business logic and user flow of application building—he particularly enjoys teaching JavaScript, Python, API design, and front-end frameworks.

Colin has taught code to a diverse group of students since learning to code himself, including young men of color at All-Star Code, elementary school kids at The Coding Space, and marginalized groups at Pursuit. He also works as an instructor for Noble Desktop, where he teaches classes in the Full-Stack Web Development Certificate and the Data Science & AI Certificate.

Colin lives in Brooklyn with his wife, two kids, and many intricate board games.

More articles by Colin Jaffe

How to Learn Machine Learning

Master machine learning with hands-on training. Use Python to make, modify, and test your own machine learning models.

Yelp Facebook LinkedIn YouTube Twitter Instagram