Do it ߏ
E3CSchools - Home
Python Casting
# Percentiles import numpy as np # Sample data data = [14, 23, 7, 45, 18, 32, 9, 27, 12, 5, 38, 16, 21, 8, 34, 29, 11, 4, 37, 25] # Calculate the 25th, 50th (median), and 75th percentiles percentile_25 = np.percentile(data, 25) percentile_50 = np.percentile(data, 50) # This is the median percentile_75 = np.percentile(data, 75) print(f"25th percentile: {percentile_25}") print(f"50th percentile (median): {percentile_50}") print(f"75th percentile: {percentile_75}")