21. Stats You Need for Data Work
21.1 Why Stats Matter Before Charts
Why. Shraddha Bagale (Pune ops) opens a bar chart of city sales. Pune looks huge. Solapur looks tiny. She almost shifts staff from Solapur to Pune. Then Ruhi Bagale shows one number: Solapur’s median order is ₹189 and Pune’s is ₹172. The chart hid that Solapur customers buy fewer but steadier baskets. Stats stop bad decisions.
What. Before you plot, compute a small summary kit: count, sum, mean, median, min, max, and a few percentiles. Charts show shape. Stats give the sentence you can send on WhatsApp.
How.
Before any chart
- Load your clean table (
orders_clean.csvfrom Chapter 16 style). - Print
df.shapeanddf["status"].value_counts(). - For ₹ columns, run
describe()and alsomedian(). - Write one plain sentence: “Pune delivered 412 orders; median basket ₹172.”
- Only then open matplotlib / seaborn.
Worked example A — Blinkit Monday vs Diwali Friday (fictional).
import pandas as pd
monday = pd.Series(
[64, 72, 80, 90, 95, 110, 120, 130, 140, 150],
name="amount_inr",
)
diwali_fri = pd.Series(
[64, 80, 90, 110, 130, 150, 180, 220, 890, 1200],
name="amount_inr",
)
def kit(s, label):
print(label)
print(" count", s.count())
print(" sum ", f"₹{s.sum():,}")
print(" mean ", f"₹{s.mean():.0f}")
print(" med ", f"₹{s.median():.0f}")
print(" min ", f"₹{s.min():,}", "max", f"₹{s.max():,}")
kit(monday, "Normal Monday — Pune dark store PUN-01")
kit(diwali_fri, "Diwali Friday — same store")
What you should see. Monday mean ≈ median (calm week). Diwali Friday mean jumps because of two big gift hampers (₹890, ₹1,200); median stays closer to everyday baskets. If Shraddha quotes only the mean on WhatsApp, the city manager over-orders gift stock next week.
Worked example B — Amazon Now Kolhapur returns.
Rani pulls 8 fictional return amounts: ₹40, ₹55, ₹60, ₹60, ₹70, ₹85, ₹90, ₹2,499 (one wrong fridge-line item tagged as grocery). Mean ≈ ₹370. Median = ₹65. The mean screams “crisis”. The median says “normal returns plus one data error”. Stats first; chart second.
Ravindra Bagale's Tip
Before you share any chart, send three numbers first: the count, the median and the max. A pretty chart without these numbers can mislead your manager, so always write the count next to the average. Your manager can look at the shape of the chart after that.
Ravindra Bagale's Tip – मराठी
कोणताही chart share करण्याआधी तीन आकडे आधी पाठवा: count, median आणि max. हे आकडे नसलेला सुंदर chart manager ची दिशाभूल करू शकतो, म्हणून average शेजारी नेहमी count लिहा. Chart चा shape manager नंतर पाहू शकतो.
Ravindra Bagale's Tip – हिंदी
कोई भी chart भेजने से पहले तीन numbers पहले भेजो: count, median और max। इन numbers के बिना सुंदर chart भी manager को गुमराह कर सकता है, इसलिए average के पास हमेशा count लिखो। Chart का shape manager बाद में देख सकता है।