# Print values above 75th percentile from series Using Quantile using Pandas

Last Updated : 31 Jul, 2023

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.

### Print values above 75th percentile from series Using Quantile

• 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.

## Python3

 `# importing pandas module` `import` `pandas as pd`   `# importing numpy module` `import` `numpy as np`   `# Making an array` `arr ``=` `np.array([``42``, ``12``, ``72``, ``85``, ``56``, ``100``])`   `# creating a series` `Ser1 ``=` `pd.Series(arr)`   `# printing this series` `print``(Ser1)`   `# calculating quantile/percentile value` `quantile_value ``=` `Ser1.quantile(q``=``0.75``)`   `# printing quantile/percentile value` `print``(``"75th Percentile is:"``, quantile_value)` `print``(``"Values that are greater than 75th percentile are:"``)`   `# Running a loop and` `# printing all elements that are above the` `# 75th percentile` `for` `val ``in` `Ser1:` `    ``if` `(val > quantile_value):` `        ``print``(val)`

Output:

`0     421     122     723     854     565    100dtype: int3275th Percentile is: 81.75Values that are greater than 75th percentile are:85100`

Explanation:

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.

Article Tags :
Practice Tags :