wk03.p1Practice exerciseWeek 03 · Data and the outside worldOpen · due in week 3

Read a real CSV with pandas

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.

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.

  1. Pick any small CSV — your own data, a published dataset, or the sample one we'll share in class.
  2. Load it with pd.read_csv() into a variable called df.
  3. Print the first five rows with .head() and the total number of rows with len(df).
  4. 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 own

How we'll grade it

Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.

CheckWhat we look forPt
It runsEnd 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 rowsPrints the actual number of rows from the file.1
Accesses a columnOne column comes out on its own with the right values.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →