TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun ยท 77.8K subscribers
Post #4537 3.5K
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 2: Mathematics for Data Science

๐Ÿ“– Topic 7: Descriptive Statistics โ€” Range, Percentiles, Quartiles, IQR & Five-Number Summary

Welcome back! ๐Ÿ‘‹

In the previous lesson you covered Probability Distributions.

Now weโ€™re moving to Descriptive Statistics โ€” how we summarize data without predicting the population.

Today weโ€™ll cover: Range, Percentiles, Quartiles, IQR, Five-number summary, Outlier detection

These are core for EDA.

๐Ÿ”น 1. What is Descriptive Statistics?

Summarizes key characteristics of a dataset.

Example: Salaries: 30000, 35000, 40000, 45000, 50000

Instead of checking each value, use: Min, Max, Mean, Median, Quartiles, Percentiles, Std Dev

๐Ÿ”น 2. Range

Formula:

Range = Maximum โˆ’ Minimum

Example: 10, 20, 30, 40, 50 โ†’ Range = 50 โˆ’ 10 = 40

Note: Very sensitive to outliers. 50 โ†’ 500 makes range jump to 490.

๐Ÿ”น 3. Percentiles โญ

Value below which X% of observations fall.

50th Percentile = Median

25th Percentile = 25% at or below

90th Percentile = 90% at or below

๐Ÿ”น 4. Real-World Example

90th percentile score โ‰  90% marks. It means you did better than โˆผ90% of people.

๐Ÿ”น 5. Quartiles

Divide data into 4 equal parts:

Q1 = 25th percentile

Q2 = 50th percentile = Median

Q3 = 75th percentile

๐Ÿ”น 6. Visualizing Quartiles

0% ---- Q1 ---- Q2 ---- Q3 ---- 100%

25% 50% 75%

๐Ÿ”น 7. Interquartile Range (IQR) โญ

Formula: IQR = Q3 โˆ’ Q1

Example: Q1=20, Q3=60 โ†’ IQR = 40. Middle 50% spans 40 units.

๐Ÿ”น 8. Why IQR Matters

Less affected by outliers than Range.

Data: 10,20,30,40,50,1000 โ†’ Range=990 but IQR ignores the 1000.

๐Ÿ”น 9. Detecting Outliers Using IQR โญ

Lower Bound = Q1 โˆ’ 1.5 ร— IQR

Upper Bound = Q3 + 1.5 ร— IQR

Values outside = potential outliers

๐Ÿ”น 10. Outlier Example

Q1=20, Q3=60 โ†’ IQR=40

Lower = 20-60 = -40

Upper = 60+60 = 120

So < -40 or > 120 are outliers

๐Ÿ”น 11. Five-Number Summary โญ

1. Minimum 2. Q1 3. Median 4. Q3 5. Maximum

Ex: 10, 20, 30, 40, 50

๐Ÿ”น 12. Box Plot

Visualizes the 5-number summary.

Box = Q1 to Q3. Line inside = Median. Whiskers = range without outliers.

๐Ÿ”น 13. Python Example

import numpy as np

data = [10, 20, 30, 40, 50, 60, 70]
q1 = np.percentile(data, 25)
median = np.percentile(data, 50)
q3 = np.percentile(data, 75)
iqr = q3 - q1
print("Q1:", q1, "Median:", median, "Q3:", q3, "IQR:", iqr)


๐Ÿ”น 14. Descriptive Statistics in Pandas

import pandas as pd

df = pd.DataFrame({"Salary": [30000, 35000, 40000, 45000, 50000]})
print(df["Salary"].describe())


describe() gives Count, Mean, Std, Min, 25%, 50%, 75%, Max

๐Ÿ”น 15. Real-World Example

Transactions: Q1=โ‚น500, Median=โ‚น1000, Q3=โ‚น2000 โ†’ IQR=โ‚น1500

Use IQR to flag fraud, bulk orders, errors, or VIP customers. Investigate before deleting.

๐Ÿ”น 16. Range vs IQR

Range: Easy but outlier-sensitive

IQR: Middle 50% only, robust to outliers

๐Ÿ”น 17. Percentile vs Percentage

Percentage = out of 100.

Ex: 80% marks

Percentile = relative position.

Ex: 90th percentile

๐Ÿ”น 18. Common Mistakes

โŒ 90th percentile = 90% score

โŒ Deleting all outliers blindly

โŒ Thinking IQR covers all data

๐ŸŽฏ Practice Questions

1. Range of 10, 20, 30, 40, 50 = ?

2. Median = which percentile?

3. Q1=25, Q3=75 โ†’ IQR = ?

4. Upper outlier boundary formula?

5. 5 components of five-number summary?

๐ŸŽฏ Key Takeaways

โœ… Range = Max - Min

โœ… Q1=25th, Q2=50th=Median, Q3=75th

โœ… IQR = Q3 - Q1

โœ… 5-number summary = Min, Q1, Median, Q3, Max

โœ… Percentile โ‰  Percentage

๐Ÿ‘‰ Double Tap โค๏ธ For More
  • โค 9
  • ๐Ÿ‘ 2
More from @datasciencefun
  1. Oct 7, 2026ORDER BY salary DESC LIMIT 5; Mistake 3 โ€” Forgetting that LIMIT applies after sorting Forโ€ฆ
  2. Oct 7, 2026๐Ÿš€ Data Science Roadmap 2026 ๐Ÿ“ Phase 3: SQL for Data Science ๐Ÿ“– Topic 4 โ€” LIMIT LIMIT isโ€ฆ
  3. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Oct 2, 2026Data Visualisation tips for beginners
  6. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’