Paths/MLOps Engineer/Python / Data Wrangling with Pandas
Write a Reproducible Loader
The loader is the boundary between raw data and your model. Write it so the path, the columns and the row count are all recorded.
Validator
IDLE — checks run live as you type commands; submit when done
01Requirements
live checks- Directory ~/ml/data exists○
- File ~/ml/data/load.py exists○
- The loader reads the dataset with pandas○
- The loader records the path and the row count○
02Walkthrough
5 steps- 01
Create the data directory
Data loading code deserves its own directory - it is the part you rerun most.
mkdir -p ~/ml/data - 02
Write the loader
DATA_PATH is a constant so the dataset location lives in exactly one place. Never paste a path into three functions.
echo 'import pandas as pd\n\nDATA_PATH = "s3://acme-raw/orders.parquet"\n\ndef load_orders():\n return pd.read_csv(DATA_PATH)' > ~/ml/data/load.py - 03
Record what you loaded
Print the shape as well as the head - a silent row loss is the failure mode you are guarding against.
echo '\ndef describe(df):\n print("rows", df.shape[0])\n return df.shape' >> ~/ml/data/load.py - 04
Verify the loader
cat prints the module. A loader you cannot read is a loader you cannot trust.
cat ~/ml/data/load.py - 05
Submit for validation
The validator checks the import, the read and the shape call.
03Stuck?
0 of 3 revealedTake a hint without losing the lab — each one points at the thing to look at, not at the answer.
04AI Tutor
guides, never solvesTell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?
04Notebook
saved locally in this browserlearner@lab — ubuntu:24.04
Session is disposable
↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list