aNet.ai
Data Science/Lab work
0day streak0XP · Lv 1
← Lab 1 overview and setup
Lab 1 · Section 2 of 6

Compare students and registrations

Part 2 · three explanations

First · connect to the lecture

The lecture distinguishes people from repeated observations. This table repeats student IDs because each row is a course registration.

Week 1: rows, keys and joins, PDF pp. 32–39, 42–53

Your task

Compare the two tables. Predict whether student_id is unique in enrolments and choose which table belongs on the left.

Evidence to include

Cite enrolment row count and distinct student count. Explain why the counts differ.

Notebook questions and code

Read here; run in your downloaded notebook. Start with its setup cells and run in order. Use your own ID and outputs where requested.

Download Lab 1 notebook

Part 2: Look at the second table

Run the next cell. Then compare it with students.

Predict first: Should student_id still be unique here? Why or why not?

Python · cell 10 — read here, run in your notebook
print(enrolments.head())
print("Is student_id unique in enrolments?", enrolments["student_id"].is_unique)
print("Number of enrolment rows:", len(enrolments))
print("Number of different students:", enrolments["student_id"].nunique())
print("Courses:", sorted(enrolments["course_code"].unique()))

Explain after running

  1. What does one row in enrolments represent? Write one sentence.
  2. Why can student_id repeat in enrolments without being an error? Write one sentence.
  3. Which table should be on the left if your final table needs one row per course registration? Write one sentence.

Saved only in this browser. This note doesn’t fill in the downloaded notebook; “reviewed” is a personal checklist, not a grade.

aNet.ai · Data Science Fundamentals · Weeks 1–5 · practice material, not an official examProgress saved in this browser