Back

Activity 2.18: Information, Metadata, Correlation, Cleaning, and Bias

divider

Activity 2.18

Information, Metadata, Correlation, Cleaning, and Bias

Key Concepts

Data Is Not Yet Information

Metadata

Moving Together Is Not Causing

Cleaning Without Changing the Meaning

Bias Comes From How Data Is Collected

Activities 2.14 to 2.17 Were About Storing Data

Bits, their limits, and how to squeeze them. All of it answers how do you keep data?

The rest of this part asks why you would want it. Today: how a pile of numbers becomes something a person can act on, what the labels on a file are for, and the most common wrong conclusion people draw from data.

Data Is Not Yet Information

Here is a week of data from a music app. What does it tell you? Decide before the next step.

Value Trace
DATA plays per day of one song
820, 790, 845, 810, 2240, 2610, 2390

Data Is Not Yet Information

Value Trace
DATA plays per day of one song
820, 790, 845, 810, 2240, 2610, 2390
INFORMATION plays nearly tripled on Friday and stayed up,
so something happened on Friday

The College Board: information is the collection of facts and patterns extracted from data. The numbers were always there. The sentence took work.

You Already Know What That Work Looks Like

A total. An average. The biggest value. How many are above some line. You wrote every one of those loops in Unit 1.

Data gives you the chance to spot a trend. It does not hand you one. Someone has to decide which question to ask of it.

One Source Is Often Not Enough

The play counts say Friday changed something. They cannot say what. A new music video? A movie soundtrack? A famous person posting it?

The College Board: often, a single source does not contain the data needed to draw a conclusion. Answering why usually means combining this data with another source.

Data About Data

Metadata is data about data. The song is the data. Its labels are the metadata.

Value Trace
THE DATA 3 minutes 12 seconds of sound
THE METADATA title: Night Drive
artist: The Parallels
added: 2026-10-30
length: 3:12
size: 4.6 MB

Data About Data

Metadata is used for finding, organizing and managing information.

  • Finding: every song by The Parallels, without playing a single one.
  • Organizing: sort a library by the date songs were added.
  • Managing: know a song is 4.6 MB before you download it on a slow connection.

Changing the Label Does Not Change the Song

The College Board: changes and deletions made to metadata do not change the primary data.

Rename the song or delete its date and every sample of the sound is exactly as it was. You changed a label, not the thing it labels. People get this wrong in both directions, so it is worth saying twice.

Two Columns That Agree

A town recorded two things every summer month. Look for the pattern.

Value Trace
month cones sold drownings
May 120 3
Jun 260 7
Jul 410 11
Aug 395 10
Sep 180 4

They rise together and fall together, every month. That is a correlation: two things that move together.

Two Columns That Agree

So does ice cream cause drowning?

No. In hot months people swim more and buy more ice cream. Something causes both, and it is in neither column.

Say It the Careful Way

The College Board: a correlation found in data does not necessarily indicate that a causal relationship exists. Additional research is needed to understand the exact nature of the relationship.

The data was not wrong. The conclusion was. A program can find correlations by the thousand; deciding which ones mean anything is still a person's job.

Open Boxes Make a Mess

A form asked people which city they live in, and gave them a box to type into. How many cities are in this list?

Value Trace
What people typed into the "city" box:
New York
new york
NY
N.Y.
New York City
new york city

Open Boxes Make a Mess

Six spellings, one city. Nobody did anything wrong. People abbreviate, spell and capitalize differently, and an open box lets them.

To a program, "NY" and "New York" are as different as "NY" and "Boston". Count the New Yorkers with == and you find one.

Cleaning Has Two Halves

The College Board: cleaning data makes the data uniform without changing its meaning.

Uniform: all six become exactly New York.

Without changing its meaning: turning Newark into New York because they look alike is not cleaning. It is damage, and it looks just as tidy.

One New Tool: ToLower

Capital letters are the commonest mess, so C# has a fix built in. ToLower() hands back a copy of a string with every letter lowercase. Predict both lines.

Demo
string shout = "PePPeRoNi";
Console.WriteLine(shout.ToLower());
Console.WriteLine(shout);
Demo
pepperoni
PePPeRoNi

One New Tool: ToLower

The second line shows the original is untouched. ToLower() is a method that belongs to the string, so it is written after the string with a dot, the way numbers.Length belongs to an array.

Lowercase both sides before comparing and capitals stop mattering, without destroying anyone's answer.

Some Data Is Just Wrong

Invalid data is an entry that cannot be true, whatever the form says. Predict how far three bad entries can move an average.

Value Trace
ages typed into a form: 17 -4 16 999 18 0 17 15
average of every entry 134.8
average of the possible ones 16.6

Some Data Is Just Wrong

Three bad entries out of eight moved the average by 118 years. Nothing crashed and nothing warned anyone.

But dropping entries is a decision. You chose which ages are possible; someone else's range would give a different answer. So whenever you drop data, say what you dropped and why.

Now the One Code Cannot Fix

Value Trace
A survey of how students get to school.
Collected through: a form on the school website
Missing: anyone without internet at home

Every answer the survey got is accurate. The problem is the answers it never got. The students it missed may well travel to school differently.

Now the One Code Cannot Fix

Value Trace
A survey of how students get to school.
Collected through: a form on the school website
Missing: anyone without internet at home
Collect ten times as many responses.
Still missing: the same students

The College Board: bias is often created by the type or source of the data collected, and bias is not eliminated by simply collecting more data. Ten times as much of the same gap is the same gap.

You Have Seen This Before

mcq-12's Question 6: a hiring tool trained on a company's past hiring records.

The records were accurate. The pattern in them was the problem, and ten more years of records would have taught the tool the same pattern more firmly. The fix is in how data is collected, not how much.

Size Changes What You Can Learn

The College Board: the size of a dataset affects how much information can be extracted from it. Six survey answers cannot show a pattern that six thousand can.

But a dataset can grow too large for one computer to process. Then the work is shared across many computers at once, a parallel system. Scalability is whether a system keeps up as its data grows. Quarter 3 covers parallel computing properly.

Today's Objectives

  • Explaining the difference between data and the information extracted from it
  • Using metadata to find data, and explaining that changing it leaves the data alone
  • Explaining why a correlation does not show a cause
  • Cleaning data so it is uniform without changing its meaning
  • Explaining why more data does not remove bias

Key Terms

Information
The collection of facts and patterns extracted from data.
Metadata
Data about data, used for finding, organizing and managing information.
Correlation
Two things that move together. On its own, not evidence that one causes the other.
Cleaning data
Making data uniform without changing its meaning.
Invalid data
An entry that cannot be true, whatever the source says.
Bias
A problem created by the type or source of the data collected. Collecting more of it does not fix it.

'F' → Fullscreen

divider

Build

Three short programs and one written task, each a different job a data analyst gets asked to do. Each program is new, so start a new file for each one.

How to read the code blocks. Each code block shows a whole program, from line 1.

Where a task changes a program you already have, the green lines marked with a + are the ones you add or change — everything else is already in your file. Do not type the + sign.


Task 1: Gaming Grows Feet?

  • A survey of six young gamers recorded how many hours a week each one plays and their shoe size. Write 2-18-big-feet and run it. The second loop counts the steps down the list where both numbers went up.
  • Write down the headline someone might publish from that last line.
2-18-big-feet
string[] players = { "Ava", "Ben", "Cal", "Dee", "Eli", "Fay" };
int[] gameHours = { 2, 4, 5, 7, 9, 12 };
int[] shoeSizes = { 1, 3, 4, 6, 8, 10 };
for (int i = 0; i < players.Length; i++)
{
Console.WriteLine($"{players[i]}: {gameHours[i]} hours a week, shoe size {shoeSizes[i]}");
}
int together = 0;
for (int i = 1; i < players.Length; i++)
{
if (gameHours[i] > gameHours[i - 1] && shoeSizes[i] > shoeSizes[i - 1])
{
together = together + 1;
}
}
Console.WriteLine();
Console.WriteLine($"More gaming, bigger feet: {together} of {players.Length - 1} steps");
  • The survey's sign-up sheet had one more column. Add the ages array and print each age, as below, and run it again.
  • Now write the real explanation, naming the thing that causes both. Which of the deck's ideas did adding a second source show?
2-18-big-feet
string[] players = { "Ava", "Ben", "Cal", "Dee", "Eli", "Fay" };
int[] gameHours = { 2, 4, 5, 7, 9, 12 };
int[] shoeSizes = { 1, 3, 4, 6, 8, 10 };
int[] ages = { 7, 9, 10, 12, 14, 16 };
for (int i = 0; i < players.Length; i++)
{
Console.WriteLine($"{players[i]}: {gameHours[i]} hours a week, shoe size {shoeSizes[i]}, age {ages[i]}");
}
int together = 0;
for (int i = 1; i < players.Length; i++)
{
if (gameHours[i] > gameHours[i - 1] && shoeSizes[i] > shoeSizes[i - 1])
{
together = together + 1;
}
}
Console.WriteLine();
Console.WriteLine($"More gaming, bigger feet: {together} of {players.Length - 1} steps");

Task 2: The Screenshot Gallery

  • A game lets players share screenshots. images holds five tiny screenshots, the data. levels, dates and places are their metadata, matched by position: screenshot 2 was taken in levels[2] on dates[2]. Write 2-18-screenshots and run it.
  • FindLevel finds every Lava Cave screenshot without ever looking at an image: it only reads levels. StripPlaces then deletes every place, the way a careful app does before sharing.
  • Answer two questions. (a) Compare the two Lava Cave printouts. What changed, and what did not? (b) Stripping places protects whom, and what can the game no longer do afterward?
2-18-screenshots
string[] images = { "..##..##..", "#.#.#.#.#.", "...####...", "##......##", ".#..##..#." };
string[] levels = { "Lava Cave", "Ice Peak", "Lava Cave", "Sky Fort", "Ice Peak" };
string[] dates = { "2026-09-14", "2026-09-20", "2026-10-02", "2026-11-11", "2026-11-19" };
string[] places = { "Columbus, OH", "Columbus, OH", "Dayton, OH", "Columbus, OH", "Toledo, OH" };
Console.WriteLine("Every Lava Cave screenshot:");
FindLevel("Lava Cave");
StripPlaces();
Console.WriteLine("After stripping the places:");
FindLevel("Lava Cave");
void FindLevel(string level)
{
for (int i = 0; i < images.Length; i++)
{
if (levels[i] == level)
{
ShowShot(i);
}
}
}
void ShowShot(int i)
{
Console.WriteLine($" image: {images[i]}");
Console.WriteLine($" level: {levels[i]}");
Console.WriteLine($" taken: {dates[i]}");
Console.WriteLine($" place: {places[i]}");
Console.WriteLine();
}
void StripPlaces()
{
for (int i = 0; i < places.Length; i++)
{
places[i] = "(removed)";
}
}

Task 3: The Pizza Poll

  • The student council asked students to type their favorite pizza topping into an open box, and the pizza order depends on the count. Write 2-18-pizza-poll and run it.
  • spellings and standards are parallel arrays, like Activity 1.26's: spellings[2] is a lowercase way people wrote a topping, and standards[2] is the clean name it stands for. Clean lowercases a vote, looks it up, and returns the clean name. A vote it does not recognize comes back as it was typed.
  • Pepperoni goes from 2 votes to 6. Nothing was miscounted before. Explain what was wrong with the first count.
  • Add the vote "Peppironi" to votes and run it. It is not cleaned. Fix it without touching Clean, and say which two arrays you changed. Then explain why adding "pepper" to the pepperoni spellings would be damage, not cleaning.
2-18-pizza-poll
string[] votes = { "Pepperoni", "pepperoni", "Cheese", "PEPPERONI", "pep", "cheese", "Peperoni", "plain cheese", "Pepperoni", "Mushroom" };
string[] spellings = { "pepperoni", "pep", "peperoni", "cheese", "plain cheese", "mushroom" };
string[] standards = { "Pepperoni", "Pepperoni", "Pepperoni", "Cheese", "Cheese", "Mushroom" };
string[] cleaned = new string[votes.Length];
for (int i = 0; i < votes.Length; i++)
{
cleaned[i] = Clean(votes[i]);
Console.WriteLine($"{votes[i]} -> {cleaned[i]}");
}
Console.WriteLine();
CountVotes("Pepperoni");
CountVotes("Cheese");
string Clean(string vote)
{
string lower = vote.ToLower();
for (int i = 0; i < spellings.Length; i++)
{
if (lower == spellings[i])
{
return standards[i];
}
}
return vote;
}
void CountVotes(string topping)
{
int before = 0;
int after = 0;
for (int i = 0; i < votes.Length; i++)
{
if (votes[i] == topping)
{
before = before + 1;
}
if (cleaned[i] == topping)
{
after = after + 1;
}
}
Console.WriteLine($"{topping}: {before} before cleaning, {after} after");
}

Task 4: The Survey You Cannot Code Away

  • No code for this one. A game studio wants to know how hard to make its next game, so it posts a survey in its own chat server and collects 400 answers.
  • (a) List at least three groups of players whose answers would be missing or under-counted, and say why for each. (b) The studio collects 4,000 answers the same way. Why does that not fix it? (c) Describe one change to how the data is collected that would actually help. Not more data: different collection.

Challenge (Optional): Spaces Count Too

  • Add the vote " cheese ", with a space at each end. It is not cleaned, and it is hard to see why.
  • C# has Trim(), which works like ToLower() but hands back a copy with spaces removed from both ends. Use it in Clean so the vote cleans, and explain why an invisible difference is the hardest kind of mess to spot.
divider

Checkpoint

Task 1, before adding ages, prints exactly this.

Task 1
Ava: 2 hours a week, shoe size 1
Ben: 4 hours a week, shoe size 3
Cal: 5 hours a week, shoe size 4
Dee: 7 hours a week, shoe size 6
Eli: 9 hours a week, shoe size 8
Fay: 12 hours a week, shoe size 10
More gaming, bigger feet: 5 of 5 steps

Task 2 prints exactly this.

Task 2
Every Lava Cave screenshot:
image: ..##..##..
level: Lava Cave
taken: 2026-09-14
place: Columbus, OH
image: ...####...
level: Lava Cave
taken: 2026-10-02
place: Dayton, OH
After stripping the places:
image: ..##..##..
level: Lava Cave
taken: 2026-09-14
place: (removed)
image: ...####...
level: Lava Cave
taken: 2026-10-02
place: (removed)

And Task 3, before you add any votes, prints exactly this.

Task 3
Pepperoni -> Pepperoni
pepperoni -> Pepperoni
Cheese -> Cheese
PEPPERONI -> Pepperoni
pep -> Pepperoni
cheese -> Cheese
Peperoni -> Pepperoni
plain cheese -> Cheese
Pepperoni -> Pepperoni
Mushroom -> Mushroom
Pepperoni: 2 before cleaning, 6 after
Cheese: 1 before cleaning, 3 after
  • You wrote the headline, then the real explanation once ages were added
  • You answered Task 2's two questions
  • Peppironi cleans to Pepperoni, and Clean is unchanged
  • You answered all three parts of Task 4, and part (c) changes how, not how much
divider

Reflection

Answer the following questions before submitting your work.

  1. Gaming hours and shoe size agreed at every single step. Explain why perfect agreement still does not prove a cause.
  2. Stripping the places left every image identical. Explain why it was still worth doing.
  3. More data fixes a dataset that is too small. It does not fix one that is biased. Explain the difference between those two problems.
divider

Submit

Submit four things to the dropbox:

  1. Your 2-18-big-feet, 2-18-screenshots and 2-18-pizza-poll program files.
  2. Your headline and real explanation, and your Task 2 answers.
  3. Your Task 3 answers and your three Task 4 answers.
  4. Your three reflection answers.

Activity Complete