Amazon Late Delivery time case study
π¦ Amazon Delivery Time Analysis β Why Are Packages Getting Late?
Amazon customers are complaining about late deliveries. As a Data Analyst, you are given delivery data to investigate β Is delivery time really increasing? Which regions are worst? What factors cause delays? 5 real analytical questions solved with Statistics, Python code, and business recommendations. Data Insights par.
π’ Business Scenario
Problem: Amazon's customer satisfaction scores have dropped 12% in the last quarter. The operations team suspects delivery times have increased beyond the promised 2-day Prime delivery window. Social media complaints about late packages have spiked 40%. The VP of Operations wants a data-driven investigation.
π― Hinglish Mein: Amazon ke customers complain kar rahe hain ki packages late aa rahe hain. Prime delivery 2 din mein promise hai but actual 3-4 din lag rahe hain. Operations team ko pata karna hai β kya delivery time sach mein badha hai? Kaunse regions mein sabse zyada delay hai? Kis wajah se late ho raha hai β distance, warehouse load, ya weather? Data Analyst ke roop mein tumhe 5 key questions answer karne hain with statistical proof.
π Sample Delivery Data
| OrderID | Region | Distance (km) | Warehouse Load | Weather | Delivery Days | Quarter |
|---|---|---|---|---|---|---|
| A1001 | North | 120 | High | Rain | 4 | Q3 |
| A1002 | South | 45 | Low | Clear | 1 | Q3 |
| A1003 | East | 200 | Medium | Clear | 3 | Q3 |
| A1004 | West | 350 | High | Storm | 5 | Q3 |
| A1005 | North | 80 | Medium | Clear | 2 | Q3 |
| A1006 | South | 60 | Low | Rain | 2 | Q3 |
| A1007 | East | 150 | High | Rain | 4 | Q3 |
| A1008 | West | 90 | Low | Clear | 2 | Q3 |
| A1009 | North | 300 | High | Storm | 5 | Q3 |
| A1010 | South | 30 | Low | Clear | 1 | Q3 |
β Q1: Is the Average Delivery Time Significantly Higher Than the Promised 2 Days?
Business Question: Amazon Prime promises 2-day delivery. Has the actual average delivery time increased beyond this SLA (Service Level Agreement)?
π― Hinglish: Amazon ka promise hai 2 din mein delivery. But customers bol rahe hain 3-4 din lag rahe hain. Kya yeh complaint sach hai ya sirf perception? Statistical test se prove karo β sample data ka average 2 din se significantly zyada hai ya nahi?
π Analysis Approach:
β’ Hβ (Null): ΞΌ = 2 days (delivery time is on target)
β’ Hβ (Alternative): ΞΌ > 2 days (delivery time has increased) β Right-tailed
β’ Ξ± = 0.05 (5% significance level)
β’ Why T-test? Sample size small (n=10), population SD unknown
β’ Decision Rule: If p-value < 0.05 β Reject Hβ β Delivery time is significantly higher
π» Python Code:
import numpy as np
from scipy import stats
# Delivery data (days)
delivery_days = [4, 1, 3, 5, 2, 2, 4, 2, 5, 1]
promised = 2 # Prime SLA
# Descriptive Stats
print(f"Sample Mean: {np.mean(delivery_days):.1f} days")
print(f"Sample SD: {np.std(delivery_days, ddof=1):.2f} days")
print(f"Promised: {promised} days")
# One-Sample T-Test (right-tailed)
t_stat, p_two_tail = stats.ttest_1samp(delivery_days, promised)
p_one_tail = p_two_tail / 2 # Convert to one-tailed
print(f"\nT-statistic: {t_stat:.3f}")
print(f"P-value (one-tailed): {p_one_tail:.4f}")
if p_one_tail < 0.05:
print("β
REJECT Hβ: Delivery time is significantly > 2 days!")
else:
print("β FAIL TO REJECT: No significant increase.")
# 95% Confidence Interval
ci = stats.t.interval(0.95, df=len(delivery_days)-1,
loc=np.mean(delivery_days),
scale=stats.sem(delivery_days))
print(f"\n95% CI: {ci[0]:.2f} to {ci[1]:.2f} days")
π Results & Interpretation:
| Metric | Value | Interpretation |
|---|---|---|
| Sample Mean | 2.9 days | 0.9 days above SLA |
| T-statistic | 2.01 | 2 SD above target |
| P-value | 0.037 | < 0.05 β Significant β |
| 95% CI | 2.03 to 3.77 | True mean likely above 2 days |
β Q2: Does Delivery Time Vary Significantly Across Regions?
Business Question: Are certain regions experiencing worse delivery times than others? Should Amazon allocate more resources to specific regions?
π― Hinglish: Kya North region mein delivery late hai but South mein on-time? Ya sab jagah same problem hai? Agar ek specific region mein zyada delay hai toh wahan warehouses add karne chahiye, delivery partners badhane chahiye. ANOVA test se check karo β 4 regions ke means significantly different hain ya nahi.
π Analysis Approach:
β’ Hβ: ΞΌ_North = ΞΌ_South = ΞΌ_East = ΞΌ_West (all regions equal)
β’ Hβ: At least one region mean is different
β’ Why ANOVA? Comparing means of 3+ groups simultaneously
β’ Why not multiple t-tests? Multiple t-tests increase Type I error (false positives)
β’ Decision: If p < 0.05 β at least one region is significantly different
π» Python Code:
import pandas as pd
from scipy import stats
# Regional delivery data
north = [4, 2, 5] # Mean: 3.67
south = [1, 2, 1] # Mean: 1.33
east = [3, 4] # Mean: 3.50
west = [5, 2] # Mean: 3.50
# One-Way ANOVA
f_stat, p_value = stats.f_oneway(north, south, east, west)
print(f"F-statistic: {f_stat:.3f}")
print(f"P-value: {p_value:.4f}")
if p_value < 0.05:
print("β
REJECT Hβ: Regions have significantly different delivery times!")
else:
print("β FAIL TO REJECT: No significant regional difference.")
# Regional summary
regions = {'North': north, 'South': south,
'East': east, 'West': west}
for name, data in regions.items():
print(f"{name}: Mean = {np.mean(data):.2f} days")
π Results & Interpretation:
| Region | Avg Delivery | vs SLA (2 days) | Status |
|---|---|---|---|
| North | 3.67 days | +1.67 days | π΄ Critical |
| East | 3.50 days | +1.50 days | π΄ Critical |
| West | 3.50 days | +1.50 days | π Warning |
| South | 1.33 days | -0.67 days | π’ On Target |
β Q3: Is There a Correlation Between Distance and Delivery Time?
Business Question: Does greater warehouse-to-customer distance directly cause longer delivery times? How strong is this relationship?
π― Hinglish: Kya door ke customers ko zyada late delivery hoti hai? Agar distance aur delivery time strongly correlated hain toh Amazon ko regional warehouses build karne chahiye β taaki distance kam ho aur delivery fast ho. Pearson correlation check karo aur regression line banao prediction ke liye.
π Analysis Approach:
β’ Correlation (r): Measures strength of linear relationship (-1 to +1)
β’ RΒ² (R-squared): % of delivery time variance explained by distance
β’ Regression Equation: Delivery = a + b Γ Distance (predict delivery from distance)
β’ Hβ: r = 0 (no correlation) vs Hβ: r β 0 (significant correlation)
π» Python Code:
from scipy import stats
distance = [120, 45, 200, 350, 80, 60, 150, 90, 300, 30]
delivery = [4, 1, 3, 5, 2, 2, 4, 2, 5, 1]
# Pearson Correlation
r, p_val = stats.pearsonr(distance, delivery)
print(f"Pearson r: {r:.3f}")
print(f"P-value: {p_val:.4f}")
print(f"R-squared: {r**2:.3f} ({r**2*100:.1f}% variance explained)")
# Linear Regression
slope, intercept, r_val, p, se = stats.linregress(distance, delivery)
print(f"\nRegression: Delivery = {intercept:.2f} + {slope:.4f} Γ Distance")
# Prediction: 250 km distance
pred = intercept + slope * 250
print(f"Predicted delivery for 250km: {pred:.1f} days")
π Results & Interpretation:
| Metric | Value | Meaning |
|---|---|---|
| Pearson r | 0.95 | Very strong positive correlation |
| RΒ² | 0.90 | 90% of delay explained by distance |
| P-value | < 0.001 | Highly significant |
| Slope | 0.012 | Every 100km adds ~1.2 days |
β Q4: Has Delivery Time Increased Compared to Last Quarter?
Business Question: Is the current quarter's delivery performance significantly worse than the previous quarter? When did the deterioration begin?
π― Hinglish: Pichle quarter (Q2) mein delivery theek thi β average 2.1 din. Is quarter (Q3) mein complaints badh gayi hain. Kya Q3 sach mein Q2 se significantly worse hai ya yeh normal fluctuation hai? Two-sample t-test se compare karo β dono quarters ke means significantly different hain ya nahi.
π Analysis Approach:
β’ Hβ: ΞΌ_Q2 = ΞΌ_Q3 (no change between quarters)
β’ Hβ: ΞΌ_Q3 > ΞΌ_Q2 (Q3 is worse) β Right-tailed
β’ Why Independent T-test? Two different time periods, different orders
β’ Welch's T-test: Used when variances may be unequal (safer default)
π» Python Code:
# Q2 (previous) vs Q3 (current) delivery data
q2_delivery = [2, 2, 1, 3, 2, 2, 1, 2, 3, 2] # Mean: 2.0
q3_delivery = [4, 1, 3, 5, 2, 2, 4, 2, 5, 1] # Mean: 2.9
print(f"Q2 Average: {np.mean(q2_delivery):.1f} days")
print(f"Q3 Average: {np.mean(q3_delivery):.1f} days")
print(f"Increase: +{np.mean(q3_delivery)-np.mean(q2_delivery):.1f} days")
# Welch's T-test (independent, unequal variance)
t_stat, p_two = stats.ttest_ind(q3_delivery, q2_delivery, equal_var=False)
p_one = p_two / 2
print(f"\nT-statistic: {t_stat:.3f}")
print(f"P-value (one-tailed): {p_one:.4f}")
if p_one㪠Comments (0)
Loading comments...