TECHNOLOGIESTieInn Technologies

Mean, median, and mode

Statistics · 14 questions

Short notes

Key idea

The mean, median and mode each describe a "typical" value in a different way. The mean uses every value; the median is the middle one; the mode is the most common. When data is skewed, they disagree, and that disagreement is itself information.

Syntax

import statistics as st
st.mean(x); st.median(x); st.mode(x)
df["amount"].mean(); df["amount"].median(); df["city"].mode()
  • Median of an even count: the average of the two middle values.

Example

Salaries (₹ thousands): 25, 28, 30, 32, 300. Mean = 83, median = 30. One very high salary drags the mean far above what most people earn, so the median is the honest "typical salary".

Traps

  • Report the median for skewed data like income, house prices, order values and delivery times.
  • The mode is the only one that works for categories (most common city).
  • An average of averages is wrong when groups have different sizes; weight by group size.
  • The mean of 0/1 values is a proportion: the mean of "converted" flags is the conversion rate.

Want the full lesson with step-by-step examples, a project and a certificate? Statistics course, ₹120 →

Questions

Open in Code Lab5 free questions
5 questions

    Mean, median, and mode

  1. Question 1easy

    Salaries in a team are mostly ₹6–8 lakh, but the founder earns ₹80 lakh. Which best describes a typical salary?

  2. Mean, median, and mode

  3. Question 2easy

    What is the median of 4, 8, 10, 30?

  4. Mean, median, and mode

  5. Question 3medium

    What does this print?

    print(products["price"].mean() > products["price"].median())
  6. Mean, median, and mode

  7. Question 4easy

    What does this print?

    print(products["price"].median())
  8. Mean, median, and mode

  9. Question 5hard

    Delhi has 2 orders averaging ₹19,733 and Chennai has 18 orders averaging ₹8,258. What's the average order across both cities?

9 more questions on this topic, with hints, and tests

Sign up free for 21 days of every question and test.