How to find interquartile range in Python using NumPy

You can find the interquartile range in Python using NumPy with the following code. If you want to learn Python then I will highly recommend you to read This Book.

How to find interquartile range in Python using NumPy
How to find the interquartile range in Python using NumPy

Step 1

Import the NumPy library.

import numpy as np

Step 2

Make an array using NumPy.

a = np.array([11, 23, 35, 19, 56, 14, 31, 21, 38, 13, 27, 36, 16, 13])

Step 3

Now find the interquartile range using the following code.

q3, q1 = np.percentile(a, [75 ,25])
inter_quar_range = q3 - q1

print(inter_quar_range)
Output
19.5

People are also reading:

Best Python Books

What is Computer Vision? Examples, Applications, Techniques

Top 10 Computer Vision Books with Python

Books for Machine Learning (ML)

Free Learning Resources

Leave a Comment

Your email address will not be published.