How to Print values above 75th percentile from series Using Quantile using Pandas?
Given a series, the task is to print all the elements that are above the 75th percentile using Pandas in Python. There is a series of data, we have to find all the values of the series object whose value is greater than the 75th Percentile.
- Create a series object of any dataset
- We will calculate 75th percentile using the quantile function of the pandas series
- We will apply for loop for iterating all the values of series object
- Inside for loop, we’ll check whether the value is greater than the 75th quantile value that is calculated in step(2) if greater then print it.
0 42 1 12 2 72 3 85 4 56 5 100 dtype: int32 75th Percentile is: 81.75 Values that are greater than 75th percentile are: 85 100
We have made a series object from an nd array and used the quantile() method to find the75% quantile or 75th percentile value of the data in the given series object and then use a for loop to find out all values of the series that are above the 75th percentile.