{}
run-icon
main.py
import pandas as pd data = {'Scores': [60, 65, 70, 80, 85, 90, 90, 100]} df = pd.DataFrame(data) # Calculating Quantiles Q1 = df['Scores'].quantile(0.25) Q2 = df['Scores'].quantile(0.50) # Median Q3 = df['Scores'].quantile(0.75) # Calculating IQR IQR = Q3 - Q1 print(f"Q1 (25th): {Q1}") print(f"Q3 (75th): {Q3}") print(f"IQR: {IQR}") # Finding Outliers lower_bound = Q1 - 1.5 * IQR upper_bound = Q3 + 1.5 * IQR outliers = df[(df['Scores'] < lower_bound) | (df['Scores'] > upper_bound)] print(f"Outliers found: {outliers.values}")
Output