Given A Series, Print All The Elements That Are Above The 75th Percentile - CBSE Project

 

 In this post, we are going to make a project of CBSE Class 12 IP. In this project, we need the help of Pandas and the NumPy library. If you don't know how to install these libraries don't worry about that I will help you how to install these libraries for Pandas type "pip install pandas" and for NumPy type "pip install numpy" in your terminal or command prompt. 

Now we will print all the elements that are above the 75th percentile

Here is the code:

import pandas as pd
import numpy as np
arr = np.array([42,12,72,85,56,100])
ser1 = pd.Series(arr)
quantile_value=ser1.quantile(q=0.25)
print("75th Quantile is :", quantile_value)
print("Values that are greater than 75th quantile value is :")
for val in ser1:
    if(val>quantile_value):
        print(val, end=" ")


Post a Comment

Previous Post Next Post