0
0
SciPydata~30 mins

Probability density and cumulative functions in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Probability Density and Cumulative Functions with SciPy
📖 Scenario: You work as a data analyst for a company that studies daily rainfall amounts. You want to understand the likelihood of different rainfall amounts using a common probability model called the normal distribution.
🎯 Goal: Build a small program that uses SciPy to calculate the probability density and cumulative probability for specific rainfall amounts using the normal distribution.
📋 What You'll Learn
Create a normal distribution with mean 50 and standard deviation 10
Calculate the probability density function (PDF) for rainfall amounts 40, 50, and 60
Calculate the cumulative distribution function (CDF) for rainfall amounts 40, 50, and 60
Print the PDF and CDF results clearly
💡 Why This Matters
🌍 Real World
Understanding rainfall probabilities helps in planning for agriculture, water management, and flood prevention.
💼 Career
Data analysts and scientists often use probability distributions to model and predict real-world events.
Progress0 / 4 steps
1
Create the rainfall amounts list
Create a list called rainfall_amounts with the exact values 40, 50, and 60.
SciPy
Need a hint?

Use square brackets to create a list with the numbers 40, 50, and 60 inside.

2
Set up the normal distribution parameters
Create two variables: mean set to 50 and std_dev set to 10.
SciPy
Need a hint?

Use simple assignment to create mean and std_dev variables with the given numbers.

3
Calculate PDF and CDF values using SciPy
Import norm from scipy.stats. Then create a normal distribution object called normal_dist using mean and std_dev. Use normal_dist.pdf() to calculate the PDF values for rainfall_amounts and store in pdf_values. Use normal_dist.cdf() to calculate the CDF values for rainfall_amounts and store in cdf_values.
SciPy
Need a hint?

Use norm(loc=mean, scale=std_dev) to create the distribution. Then call pdf() and cdf() with the list rainfall_amounts.

4
Print the PDF and CDF results
Print the pdf_values and cdf_values variables. Use print() statements with clear labels: "PDF values:" and "CDF values:".
SciPy
Need a hint?

Use two print statements. Print the label first, then the variable.