Data Science · मराठी आवृत्ती
21.3 Spread: min, max, quartiles आणि IQR
या course चे सर्व chapters (py + ch)
- How to Use This Free Data Science Course
- How to Install Python, Jupyter Notebook and VS Code for Data Science (Windows and Mac)
- Python Variables and Data Types Explained for Beginners (int, float, str, bool)
- Python Strings Tutorial: Slicing, f-strings and String Methods with Examples
- Python Lists, Tuples, Dictionaries and Sets Explained with Examples
- Python if, elif and else Statements with Real Examples for Beginners
- Python for Loops and while Loops Explained with Examples (range, break, continue)
- Python Functions Tutorial: def, return, Arguments and lambda with Examples
- Python Errors and Exceptions: How to Use try, except, else and finally
- How to Read and Write CSV, JSON and Text Files in Python (with open and with)
- Python Modules, pip and Virtual Environments (venv) Explained for Beginners
- Python Classes and Objects for Beginners: OOP Basics with Simple Examples
- NumPy Tutorial for Beginners: Arrays, Maths and Filtering in Python
- Python Mini Projects for Beginners: 5 Practice Projects Before Learning pandas
- Data Science vs Data Analytics Tutorial
- Python Jupyter Setup for Data Science
- Python Basics for Data Science Tutorial
- NumPy Essentials for Data Science Tutorial
- pandas DataFrames and Series Tutorial
- Filter and Sort Data in pandas Tutorial
- pandas GroupBy and Aggregations Tutorial
- Merge and Concat Data in pandas Tutorial
- Data Cleaning in pandas A–Z Tutorial
- Dates and Text in pandas – Free Tutorial
- Reshape Data: melt and pivot_table
- Exploratory Data Analysis in Python
- matplotlib Visualization Tutorial – Free
- seaborn Visualization Tutorial – Free
- Chart Choice and Data Storytelling
- Data Science Project: Blinkit Maharashtra
- Data Science Practice Exercises
- Data Science Interview Questions
- pandas matplotlib seaborn Cheat Sheet
- Data Science Glossary – Free Tutorial
- Stats for Data Work Mean Median IQR
- Export CSV Excel PNG from pandas Tutorial
- Common pandas Mistakes and Fixes Tutorial
- Load SQL Query Results into pandas DataFrame – Free Tutorial
- How to Rank and Running Totals in pandas
- How to Read APIs, JSON and Zipped CSVs into pandas
- How to Use Git with Jupyter Notebooks for Data Projects
- How to Merge and Join Tables in pandas for Blinkit Data
- What Is Machine Learning Simple Explanation
- Machine Learning Workflow Step by Step
- Train Test Split in Machine Learning sklearn
- Features and Labels in Machine Learning
- Linear Regression in Python with sklearn
- Classification with Logistic Regression in Python
- Decision Trees and Random Forests in Python
- K-Means Clustering in Python for Beginners
- How to Check If Your ML Model Is Good
- Overfitting and Underfitting in Machine Learning
- End-to-End ML Project India Dataset
- Data Preprocessing for ML: Impute Scale Encode
- What Is a Neural Network Simple Explanation
- Activation Loss Gradient Descent Plain English
- Backpropagation Intuition No Heavy Maths
- Install PyTorch and First Tensors
- Your First Neural Network in PyTorch
- Deep Learning vs Classical ML When to Use Which
- Convolutional Neural Networks CNNs for Images
- Small CNN Image Project in PyTorch
- What Transformers Are Text and Sequences
- Tiny Text Classifier Transformer Intro PyTorch
- What Is Natural Language Processing NLP
- Text Cleaning and TF-IDF in Python sklearn
- Sentiment Analysis Project in Python TF-IDF
- NLP vs ChatGPT Classical NLP and Generative AI
हे का शिकायचं?
फक्त average पुरेसं नाही. Spread सांगतो orders किती पसरलेल्या आहेत.
हे काय आहे?
Min/max = टोक. Quartiles = 25%/50%/75%. IQR = Q3−Q1 — मधला 50% किती रुंद.
कसं करायचं?
Step 1. amount.describe() चालवा.
Step 2. min, 25%, 50%, 75%, max वाचा.
Step 3. IQR = Q3 - Q1 काढा.
Step 4. रुंद IQR म्हणजे amounts मध्ये मोठा फरक.
उदाहरणं: copy करा आणि चालवा
उदाहरण A — Delivery minutes, six cities (fictional).
import pandas as pd
mins = pd.DataFrame({
"city": (
["Pune"] * 8
+ ["Solapur"] * 6
+ ["Nashik"] * 6
+ ["Sambhaji Nagar"] * 5
+ ["Kolhapur"] * 5
+ ["Nagpur"] * 6
),
"delivery_mins": [
8, 9, 10, 11, 12, 14, 18, 45, # Pune: one late
10, 11, 11, 12, 13, 14, # Solapur calm
9, 10, 12, 15, 16, 40, # Nashik one late
11, 12, 13, 14, 55, # Sambhaji Nagar late
10, 11, 12, 12, 13, # Kolhapur tight
9, 10, 11, 12, 20, 22, # Nagpur wider
],
})
g = mins.groupby("city")["delivery_mins"]
summary = g.agg(
n="count",
min="min",
q1=lambda s: s.quantile(0.25),
median="median",
q3=lambda s: s.quantile(0.75),
max="max",
)
summary["iqr"] = summary["q3"] - summary["q1"]
print(summary.round(1))
What you should see. Kolhapur IQR is tiny (tight SLA). Pune and Sambhaji Nagar show a high max — investigate those rows (rain? wrong geo pin?) before blaming riders.
उदाहरण B — ₹ IQR for Blinkit Pune evening slot.
pune_amt = pd.Series([55, 60, 72, 80, 90, 95, 110, 120, 135, 150, 180, 900])
q1, q2, q3 = pune_amt.quantile([0.25, 0.5, 0.75])
iqr = q3 - q1
low, high = q1 - 1.5 * iqr, q3 + 1.5 * iqr
print("Q1", q1, "median", q2, "Q3", q3, "IQR", iqr)
print("fence", low, high)
print("flag rows", pune_amt[(pune_amt < low) | (pune_amt > high)].tolist())
The ₹900 gift box is flagged. Amir does not delete it blindly — he checks order_id BLK-261019-088 and keeps it with a note “festival SKU”.
उदाहरण C — Min/max traps.
bad = pd.Series([9, 10, 11, 12, 999]) # 999 = sensor default in raw extract
print("max with typo", bad.max())
print("max after fix", bad[bad < 120].max())
Always eye-max. A single 999 delivery-mins row can break a dashboard SLA tile.