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
Chart sundar asla tari pehle teen numbers WhatsApp la pathva: count, median, max. Manager la shape nantar hava. Bilkul visru naka.