Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

DA 3.7: Preparing data so it can be used

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

45 minutes

Fifty-one players, or thirty-eight?

A made-up football club joins three sign-up lists into one. The new list says 51 players. The coach knows there are 38.

Nothing is wrong with the maths. Some players are on two lists, and a few are spelt two ways. The data was not ready.

Key words

WordWhat it meansExample
SourcingFinding out where the data you need is held and who owns it.Three sign-up lists
CollectingGetting a copy of the data into one place.Save each list in one folder
CleansingFixing or removing data that is wrong, odd or repeated.Sam and sam become one name
BlendingCombining data from different sources into one consistent set.Three lists become one
DuplicateThe same thing recorded more than once.A player on two lists
StandardiseWrite every value in the same style.All names in small letters

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can say why data is prepared, and put sourcing, collecting, cleansing and blending in order with a job for each.

Starter: last lesson

Have a go

Starter: last lesson

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Why we prepare data

Data from real life is messy. People type names in different ways. Two systems record the same thing twice. A cell is left empty.

Prepare data first and the analysis uses it well. Skip that and the answer is wrong, and the answer still looks neat. Bad data in gives a bad answer out.

Worked example: the club, step by step

StepThe jobThe club exampleIf you skip it
SourcingFind where the data is and who owns itPaper form, web form and an old sheetYou miss a list
CollectingCopy it all into one placeType the paper form. Save all three files togetherData stays scattered
CleansingFix wrong, odd and repeated valuesSam and sam become one nameYou count Sam twice
BlendingCombine into one consistent setOne list of 38 playersThree lists that do not fit

The cells students fill in are left blank in this preview.

Try it: the cost of not cleansing

Code: python
raw = ["Sam", "sam ", "Ana", "ANA", "Lee", "Sam"]

print("Rows in the list:", len(raw))

clean = []
for name in raw:
    tidy = name.strip().lower()
    if tidy not in clean:
        clean.append(tidy)

print("Different players:", len(clean))
print(clean)

# Try it: add " lee" to the end of raw and run again.

The lesson goes on

4 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.