What you'll build
Pick a small dataset, load it with pandas, peek at the rows, count them, and pull out a single column. The smallest honest data workflow.
Requirements
The must-do parts. If any are missing, we'll ask you to take another pass.
- Pick any small CSV — your own data, a published dataset, or the sample one we'll share in class.
- Load it with
pd.read_csv()into a variable calleddf. - Print the first five rows with
.head()and the total number of rows withlen(df). - Pick one column and print it on its own using
df["column_name"].
Bonus, if you're feeling brave
- Print only the unique values in that column.
- Print the column type and the count of missing values for that column.
Where to start
Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.
read_csv.py
import pandas as pd
df = pd.read_csv("your-file.csv")
# TODO: print the first five rows
print(df.head())
# TODO: print the number of rows
# TODO: print one column on its ownHow we'll grade it
Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.
| Check | What we look for | Pt |
|---|---|---|
| It runs | End to end in a fresh notebook with pandas installed. | 1 |
| Loads the data | `df` is a DataFrame and `.head()` shows real rows. | 1 |
| Counts the rows | Prints the actual number of rows from the file. | 1 |
| Accesses a column | One column comes out on its own with the right values. | 1 |