The question
Combine two compatible delivery exports into one handoff.
df + second Combined handoffYour inputs
df
Both duration and minutes are elapsed minutes. Preserve both source tables.
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 | 45 | 4 | 2026-04-03 |
View all 12 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 | 45 | 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 | 3.3 | 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 |
second
Second batch uses duration for minutes, recorded as numeric text. IDs do not overlap between batches.
Field meanings and units
delivery_id- Delivery identifier.
depot- Depot responsible for the delivery.
status- Recorded delivery state.
weight_kg- Weight in kilograms.
date- Calendar date supplied as YYYY-MM-DD text unless the task states it is invalid.
duration- Elapsed minutes, supplied as text.
delivery_id | depot | status | weight_kg | date | duration |
|---|---|---|---|---|---|
| D112 | North | Returned | 1.9 | 2026-04-06 | 62 |
| D111 | West | Pending | 1.2 | 2026-04-06 | 26 |
| D110 | East | Delivered | 4 | 2026-04-05 | 49 |
| D109 | North | Delivered | 3.3 | 2026-04-05 | 33 |
| D108 | West | Returned | 2.6 | 2026-04-04 | 29 |
View all 12 rows
delivery_id | depot | status | weight_kg | date | duration |
|---|---|---|---|---|---|
| D112 | North | Returned | 1.9 | 2026-04-06 | 62 |
| D111 | West | Pending | 1.2 | 2026-04-06 | 26 |
| D110 | East | Delivered | 4 | 2026-04-05 | 49 |
| D109 | North | Delivered | 3.3 | 2026-04-05 | 33 |
| D108 | West | Returned | 2.6 | 2026-04-04 | 29 |
| D107 | East | Pending | 1.9 | 2026-04-04 | 72 |
| D106 | North | Delivered | 1.2 | 2026-04-03 | 37 |
| D105 | West | Delivered | 4 | 2026-04-03 | 45 |
| D104 | East | Returned | 3.3 | 2026-04-02 | 61 |
| D103 | North | Pending | 2.6 | 2026-04-02 | 25 |
| D102 | West | Delivered | 1.9 | 2026-04-01 | 48 |
| D101 | East | Delivered | 1.2 | 2026-04-01 | 32 |
The editable setup in Your Python creates these inputs when you run it.
Combine two compatible delivery exports into one handoff.
combinedDataFramerecord_countnumberDeliverables
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
- numeric
- a number, rather than text
- Combined deliveriesOutput
combinedDataFrame- Use
dfandsecondas your inputs. - In a separate copy of
second, renamedurationtominutesand convert its numeric text to numbers. - Append the two batches and keep every row, using the same columns in the same order as
df. - Store the finished table in
combined. - Keep both inputs unchanged.
- Use
- Combined record countOutput
record_countnumber- Count all rows in
combinedand store that number inrecord_count.
- Count all rows in
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
Are similarly named fields expressing the same quantity in the same unit?
Hint 2 — Tools
rename(), to_numeric() and concat()
Revisit: Rename columns · Convert numeric text · Stack datasets · Sort and reset
Hint 3 — Approach
Align the second batch’s name and numeric type, append all rows using df column order, then count the combined records.
Explained solution
Add these lines below # Your work in the editor. The supplied input setup is already there.
batch = second.rename(columns={'duration': 'minutes'}).copy()
batch['minutes'] = pd.to_numeric(batch.minutes)
combined = pd.concat([df, batch[df.columns]], ignore_index=True)
record_count = len(combined)
combinedView supplied setup
This code is already at the top of the editor.
import pandas as pd
# Supplied input: df (12 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', 45, 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, 3.3, '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'),
],
columns=['delivery_id', 'depot', 'status', 'minutes', 'weight_kg', 'date'],
)
# Supplied input: second (12 rows)
second = pd.DataFrame(
[
('D112', 'North', 'Returned', 1.9, '2026-04-06', '62'),
('D111', 'West', 'Pending', 1.2, '2026-04-06', '26'),
('D110', 'East', 'Delivered', 4, '2026-04-05', '49'),
('D109', 'North', 'Delivered', 3.3, '2026-04-05', '33'),
('D108', 'West', 'Returned', 2.6, '2026-04-04', '29'),
('D107', 'East', 'Pending', 1.9, '2026-04-04', '72'),
('D106', 'North', 'Delivered', 1.2, '2026-04-03', '37'),
('D105', 'West', 'Delivered', 4, '2026-04-03', '45'),
('D104', 'East', 'Returned', 3.3, '2026-04-02', '61'),
('D103', 'North', 'Pending', 2.6, '2026-04-02', '25'),
('D102', 'West', 'Delivered', 1.9, '2026-04-01', '48'),
('D101', 'East', 'Delivered', 1.2, '2026-04-01', '32'),
],
columns=['delivery_id', 'depot', 'status', 'weight_kg', 'date', 'duration'],
)Why these steps exist
- The second batch uses a different name and numeric text for the same duration unit. Both must be aligned.
- Appending retains every record; matching the batches by depot instead would combine unrelated deliveries.
Another valid approach
Align names and types in separate copies before concatenation; the order of those independent preparations may differ.