0
0
SciPydata~30 mins

Percentiles and quantiles in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Calculating Percentiles and Quantiles with SciPy
📖 Scenario: You work in a small bakery that tracks daily sales of bread loaves. You want to understand how sales vary by calculating percentiles and quantiles. This helps you see typical sales and spot busy or slow days.
🎯 Goal: Build a simple Python program using SciPy to calculate specific percentiles and quantiles from daily sales data.
📋 What You'll Learn
Create a list of daily sales numbers called daily_sales with exact values
Create a variable called quantile_value to specify which quantile to calculate
Use SciPy's scoreatpercentile function to find the percentile
Use SciPy's mquantiles function to find the quantile
Print the results clearly
💡 Why This Matters
🌍 Real World
Percentiles and quantiles help businesses understand data spread, like sales performance or customer wait times, to make better decisions.
💼 Career
Data analysts and scientists often calculate percentiles and quantiles to summarize data and report insights clearly.
Progress0 / 4 steps
1
Create the daily sales data list
Create a list called daily_sales with these exact values: [15, 22, 13, 27, 19, 30, 25].
SciPy
Need a hint?

Use square brackets to create a list and separate numbers with commas.

2
Set the quantile value
Create a variable called quantile_value and set it to 0.75 to represent the 75th percentile.
SciPy
Need a hint?

Assign the number 0.75 to the variable quantile_value.

3
Calculate the 75th percentile and quantile
Import scoreatpercentile and mquantiles from scipy.stats. Then calculate the 75th percentile of daily_sales using scoreatpercentile with 75 as the percentile. Also calculate the quantile using mquantiles with quantile_value. Store results in percentile_75 and quantile_75 respectively.
SciPy
Need a hint?

Use scoreatpercentile(daily_sales, 75) and mquantiles(daily_sales, prob=[quantile_value]). Remember mquantiles returns a list, so get the first item.

4
Print the percentile and quantile results
Print the values of percentile_75 and quantile_75 with clear messages. Use print statements to show:
"75th Percentile: " followed by percentile_75
"75th Quantile: " followed by quantile_75.
SciPy
Need a hint?

Use two print statements with the exact text and variables.