The question
Give the next analyst a compact intake brief and a reliable completed-delivery summary.
df Intake briefYour inputs
df
One row is one delivery record. Some durations are unknown; Pending and Returned records still belong in the intake metadata.
Field meanings and units
delivery_id- Delivery identifier.
depot- Depot responsible for the delivery.
status- Recorded delivery state.
minutes- Elapsed duration in minutes; unknown is not zero.
weight_kg- Weight in kilograms.
date- Calendar date supplied as YYYY-MM-DD text unless the task states it is invalid.
delivery_id | depot | status | minutes | weight_kg | date |
|---|---|---|---|---|---|
| D001 | East | Delivered | 32 | 1.2 | 2026-04-01 |
| D002 | West | Delivered | 48 | 1.9 | 2026-04-01 |
| D003 | North | Pending | 25 | 2.6 | 2026-04-02 |
| D004 | East | Returned | 61 | 3.3 | 2026-04-02 |
| D005 | West | Delivered | None | 4 | 2026-04-03 |
View all 18 rows
delivery_id | depot | status | minutes | weight_kg | date |
|---|---|---|---|---|---|
| D001 | East | Delivered | 32 | 1.2 | 2026-04-01 |
| D002 | West | Delivered | 48 | 1.9 | 2026-04-01 |
| D003 | North | Pending | 25 | 2.6 | 2026-04-02 |
| D004 | East | Returned | 61 | 3.3 | 2026-04-02 |
| D005 | West | Delivered | None | 4 | 2026-04-03 |
| D006 | North | Delivered | 37 | 1.2 | 2026-04-03 |
| D007 | East | Pending | 72 | 1.9 | 2026-04-04 |
| D008 | West | Returned | 29 | 2.6 | 2026-04-04 |
| D009 | North | Delivered | 33 | None | 2026-04-05 |
| D010 | East | Delivered | 49 | 4 | 2026-04-05 |
| D011 | West | Pending | 26 | 1.2 | 2026-04-06 |
| D012 | North | Returned | 62 | 1.9 | 2026-04-06 |
| D013 | East | Delivered | 46 | 2.6 | 2026-04-07 |
| D014 | West | Delivered | 38 | 3.3 | 2026-04-07 |
| D015 | North | Pending | 73 | 4 | 2026-04-08 |
| D016 | East | Returned | 30 | 1.2 | 2026-04-08 |
| D017 | West | Delivered | 34 | 1.9 | 2026-04-09 |
| D018 | North | Delivered | 50 | 2.6 | 2026-04-09 |
The editable setup in Your Python creates these inputs when you run it.
Give the next analyst a compact intake brief and a reliable completed-delivery summary.
dimensionstuplemissingSeriesmean_minutesSeriesDeliverables
Make the outputs listed below. Use each name exactly as shown. Then choose Check answer.
Python name key
Teal outlines name table columns. Violet left rules name Python objects. Dotted rules mark syntax, functions and parameters. Use each name exactly as shown.
Words in this task
- missing
- no value was supplied
- Table shapeOutput
dimensionstuple- Store the shape of the full
dfindimensions: its number of rows and columns (df.shape).
- Store the shape of the full
- Missing values by columnOutput
missingSeries- Store the missing-value count for every column in missing.
- Completed-delivery meansOutput
mean_minutesSeries- Store the mean
minutesfor Delivered records bydepotinmean_minutes. - Unknown durations are excluded from each mean.
- Store the mean
Data policy Keep all supplied source tables unchanged. Work on separate outputs.
Help Hints & explained solution
Choose the amount of help you need. Opening one hint does not reveal the others.
Hint 1 — Think
Which outputs describe all records, and which describe completed deliveries only?
Hint 2 — Tools
shape, isna(), sum(), groupby() and mean()
Revisit: How big is it? · Find missing values · Summarise groups · Combine conditions
Hint 3 — Approach
Collect whole-table metadata first; independently restrict the delivery summary to completed records.
Explained solution
Add these lines below # Your work in the editor. The supplied input setup is already there.
dimensions = df.shape
missing = df.isna().sum()
mean_minutes = df[df.status == 'Delivered'].groupby('depot').minutes.mean()
mean_minutesView supplied setup
This code is already at the top of the editor.
import pandas as pd
# Supplied input: df (18 rows)
df = pd.DataFrame(
[
('D001', 'East', 'Delivered', 32, 1.2, '2026-04-01'),
('D002', 'West', 'Delivered', 48, 1.9, '2026-04-01'),
('D003', 'North', 'Pending', 25, 2.6, '2026-04-02'),
('D004', 'East', 'Returned', 61, 3.3, '2026-04-02'),
('D005', 'West', 'Delivered', None, 4, '2026-04-03'),
('D006', 'North', 'Delivered', 37, 1.2, '2026-04-03'),
('D007', 'East', 'Pending', 72, 1.9, '2026-04-04'),
('D008', 'West', 'Returned', 29, 2.6, '2026-04-04'),
('D009', 'North', 'Delivered', 33, None, '2026-04-05'),
('D010', 'East', 'Delivered', 49, 4, '2026-04-05'),
('D011', 'West', 'Pending', 26, 1.2, '2026-04-06'),
('D012', 'North', 'Returned', 62, 1.9, '2026-04-06'),
('D013', 'East', 'Delivered', 46, 2.6, '2026-04-07'),
('D014', 'West', 'Delivered', 38, 3.3, '2026-04-07'),
('D015', 'North', 'Pending', 73, 4, '2026-04-08'),
('D016', 'East', 'Returned', 30, 1.2, '2026-04-08'),
('D017', 'West', 'Delivered', 34, 1.9, '2026-04-09'),
('D018', 'North', 'Delivered', 50, 2.6, '2026-04-09'),
],
columns=['delivery_id', 'depot', 'status', 'minutes', 'weight_kg', 'date'],
)Why these steps exist
- The table shape and missing counts describe all incoming records, including incomplete deliveries.
- Only completed deliveries belong in the duration summary; unknown durations do not represent zero-minute deliveries.
Another valid approach
Whole-table metadata and the filtered group summary can be calculated independently; do not reuse the smaller population for missingness.