The question
A delivery file has arrived. Establish what it contains before anyone uses it.
delivery.csv CSV intakeYour inputs
delivery.csv
One row is one delivery record. delivery.csv has a header row; dates are YYYY-MM-DD text.
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 16 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 |
| 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 |
The file is available in the Python working folder. Load it yourself.
A delivery file has arrived. Establish what it contains before anyone uses it.
previewDataFramedimensionstupletypesSeriesDeliverables
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.
- First lookOutput
previewDataFrame- Load
delivery.csvintodfand keep its first five records inpreview.
- Load
- Table shapeOutput
dimensionstuple- Store the shape of the full
dfindimensions: its number of rows and columns (df.shape).
- Store the shape of the full
- Column
typesOutputtypesSeries- Store the data type of each imported column in
types(df.dtypes).
- Store the data type of each imported column 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
How can you inspect a sample without shortening the imported table?
Hint 2 — Tools
read_csv(), head(), shape and dtypes
Revisit: Load a CSV · Take the first look · How big is it? · What types are these?
Hint 3 — Approach
Load the entire file, inspect a small preview, and collect metadata from the entire imported table.
Explained solution
Add these lines below # Your work in the editor. The supplied input setup is already there.
df = pd.read_csv('delivery.csv')
preview = df.head()
dimensions = df.shape
types = df.dtypes
previewView supplied setup
This code is already at the top of the editor.
import pandas as pdWhy these steps exist
- The preview contains five rows;
df.shapeanddf.dtypesdescribe the entire imported file. - Keeping
dfintact allows a later analyst to inspect records beyond the first five.
Another valid approach
You can inspect the complete file and keep a separate preview variable; slicing the imported df itself would lose records.