Skip to main content
AP CSP course

C16 · Topic 2.4 · 40 minutes · DAT-2.D, DAT-2.E

Combining datasets responsibly

By the end you can:

  • Match records using appropriate keys.
  • Convert inconsistent units before comparison.
  • Evaluate representation and missingness after a join.

Before this lesson: topics 2.3, 3.10.

Cleaning
Applying documented rules to inconsistent, duplicate or missing data.
Join key
A field used to match records across datasets.

Understand

A join combines records by a specified matching rule. Names may be duplicated or inconsistent; a stable identifier can reduce accidental matches. Different units and definitions still require reconciliation. A successful technical join does not prove that the resulting rows describe comparable events or the intended population.

Check which records have no match and whether excluded records differ systematically. A programme can efficiently produce a misleading summary if its rules duplicate observations, mix units or discard an underrepresented group. Keep provenance, question scope and privacy constraints visible throughout the processing pipeline.

Worked example

A trip-time table uses minutes and trip IDs. A second table has one distance per trip in kilometres, but C is missing.

  1. Match on trip ID, not a traveller’s possibly repeated name.
  2. A mean speed using only matched records must disclose that C was excluded.
  3. If another distance source uses miles, convert to a documented common unit before comparing speeds.

Explore each concept

Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.

  • Keys and unit conversion
  • Normalisation
  • Transformation and classification
  • Tool capacity and scaling
Open this example on its own

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to explore: Join, transform, classify and scale data
  1. PipelinejoinWaiting
  2. Join keystable-idWaiting

Ready to explore: Join, transform, classify and scale data

Why: Change an input, predict the first effect, then advance one step.

Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.

Step through and experiment

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to experiment
  1. Input 1deduplicateWaiting
  2. Input 2excludeWaiting

Ready to experiment

Why: Predict the first change, then advance one step.

Try this: Change only one cleaning policy. Which numerator or denominator changes?

Check a misconception

Claim: A join that runs without errors guarantees a valid conclusion.

Correct matching, units, missingness and collection scope still determine whether the analysis is meaningful.

Guided practice

Explain why matching on a nonunique name can multiply rows.

Work with a partner. Make a prediction, compare your reasoning, then identify the rule that supports your answer.

Independent transfer

Design a join audit with at least three reported quantities.

Exit check

Does a larger joined file necessarily contain more independent observations?

Write your reasoning before comparing with a classmate. If your teacher assigned this task, submit it through My classes to save your work and receive feedback.

Check yourself

  1. Question 1 of 2Which is the best first response to distances in mixed miles and kilometres?

    Select one answer.

  2. Question 2 of 2A join drops all unmatched rural trip IDs. What should be investigated?

    Select one answer.

Your practice so far

Check an answer to see its rationale.

Teacher guidance and scoring