Each run starts with fresh data. Download any exported files before another run. Your written answers and code drafts are saved on this device; export your work to keep a backup.
M15C01 · Explore · predict · practice
Mean and median respond differently
The mean uses every numeric value in an arithmetic average. The median is the middle value after sorting. Comparing them can help you notice how an unusually large or small observation affects a summary.
Read the example
costs = pd.Series([10, 20, 30, 40, 50]) # Fictional costs in AED
result = pd.Series({"Mean_AED": costs.mean(), "Median_AED": costs.median()})
print(result)
Verified example output · pandas 2.2.3
Mean_AED 30.0
Median_AED 30.0
dtype: float64
Watch for this. An extreme value is not automatically a mistake; investigate its source and meaning.
Your turn
Change the last cost from 50 to 500. Recalculate mean and median in result.
For the code check, keep these result variable names: result. Different valid approaches are welcome.
The mean rises to AED 120, while the median stays AED 30. The large value has a stronger effect on the mean.
Compare your explanations
Read. (10 + 20 + 30 + 40 + 50) / 5 = 30.
Predict. 30, the middle value of the five sorted costs.
Explain. No. It only describes this set of numbers; validation is a separate task.
One quick check
Which summary stays 30 after this change?
What you should be able to explain. Explain which summary fits the question and distribution.
M15C02 · Explore · predict · practice
Spread and the standard-deviation convention
Standard deviation measures spread around the mean in the same units as the values. pandas uses sample standard deviation by default, with ddof=1. ddof=0 uses the population-style denominator; choose based on what the data represent.
Both standard deviations are zero because every value equals the mean.
Compare your explanations
Read. It changes the denominator from n to n minus ddof in the variance calculation.
Predict. The sample value, 2.0, is larger than the population-style value, about 1.633.
Explain. No. The standard deviation would also be multiplied by 60 because it has the same units.
One quick check
Which ddof does pandas std() use by default?
What you should be able to explain. State the spread measure and its convention.
M15C03 · Explore · predict · practice
Describe, count, and quantiles
describe() summarizes a numeric Series with count, mean, spread, and selected percentiles. Count excludes missing values; size counts all entries. A quantile describes a position in the distribution, and its value may be interpolated between observations.
With the default linear interpolation, the quartiles are 67.5, 75.0, and 82.5.
Compare your explanations
Read. No. Its count is 4, while the Series has 5 entries.
Predict. 75.0, halfway between the two middle known values, 70 and 80.
Explain. Readers need to know how many observations support the average and how much information is missing.
One quick check
Which quantity includes a missing entry?
What you should be able to explain. Report completeness alongside summary statistics.
M15C04 · Explore · predict · practice
Correlation describes association
corr() computes pairwise correlations between numeric variables; its default method is Pearson correlation. Positive values indicate that higher values tend to occur together in a linear pattern. Correlation does not establish that one variable causes the other.
Read the example
df = students()
result = df[["Study_Hours", "Score", "Attendance"]].corr(method="pearson")
print(result.round(3))