AP Computer Science Principles · Study guide

Extracting Information from Data

AP® Computer Science Principles · Big Idea 2 · Data

Extracting Information from Data

How to pull trends, connections, and problems out of data, why a correlation is not proof of a cause, what metadata are for, and the problems that make real data hard to process.

1Data and information

Data are raw values: numbers, words, measurements, clicks. Information is the collection of facts and patterns pulled out of data. A spreadsheet of a year's bus arrival times is data; “the 7:40 bus is late most Mondays” is information.

Data give people the chance to spot trends (something rising or falling over time), make connections (two things that go together), and address problems (finding where something goes wrong so it can be fixed).

2Correlation is not causation

When a program processes data, it may find a correlation: two variables that tend to move together, so when one is high the other tends to be high (or low). A correlation is real information. But it does not show that one variable causes the other. A hidden third variable may drive both, or the cause may run the other way. Finding out what is really going on takes more research.

Figure 1. Ice cream sales and sunburns move together (correlation 0.99), but neither causes the other. Hot weather drives both.

Over 10 summer days at a beach town, ice cream sales and sunburn cases have a correlation of 0.99, very close to the strongest possible value of 1. Banning ice cream would not prevent a single sunburn. Hot weather sends people to the beach, where they buy ice cream and get sunburned.

A conclusion the data can support says the two are related and stops there: “Days with more ice cream sales tend to have more sunburns.” A conclusion with “causes,” “makes,” or “leads to” needs evidence the data do not have.

3Combining data sources

Often a single source does not contain the data needed to answer a question. The sales file has no temperatures, and the weather file has no sales. Combining them works because both record the same thing in the same way, here the date:

DateHigh temperature (°C), weather fileCones sold, sales file
Jun 21941
Jun 52688
Jun 92257
Jun 1230120
Jun 162366
Jun 1932135
Jun 2328102
Jun 262049
Jun 3033143
Jul 32795

Joined together, the data show a connection neither file shows alone: on days at 28 °C or hotter, the stand sold 125 cones on average; on cooler days, 66. The correlation between temperature and sales is 1.00.

Combining goes wrong without warning when the sources don't line up: one file writes “Jul 3” and the other “07/03/2026”, one uses °F and the other °C, or they cover different years. The program still produces a neat table; it just describes things that don't belong together.

4Metadata

Metadata are data about data. If the data is a photo, its metadata might include the date it was taken, the location, the camera, and the file size. If the data is an email, the metadata include the sender, the time sent, and the subject line.

Figure 2. Metadata describe the data without being the data. Changing or deleting metadata leaves the primary data as it was.

Changing or deleting metadata does not change the primary data. To check, this page's build made a tiny image file, then changed its location tag from “home” to “beach” and also made a copy with no tags at all. The three files are different as wholes, but their pixel data is identical in all three (same fingerprint, 33daa9554a8a…).

Metadata are used for finding, organizing, and managing information. They let data be structured and organized, and they make data more useful by adding information about it. In a photo library, a program can answer questions from the metadata alone, without opening a single picture:

FileDate takenLocationSize (MB)
IMG_0412.jpg2026-06-14Lake Ridge3.1
IMG_0413.jpg2026-06-14Lake Ridge2.8
IMG_0520.jpg2026-07-02Grandma's house4.6
IMG_0521.jpg2026-07-02Grandma's house4.4
IMG_0533.jpg2026-07-19Lake Ridge5.2
IMG_0601.jpg2026-08-09School1.9
  • Finding: photos from July are IMG_0520.jpg, IMG_0521.jpg, IMG_0533.jpg.
  • Organizing: grouping by location puts 3 photos under Lake Ridge.
  • Managing: to free up space, the biggest file is IMG_0533.jpg (5.2 MB).

Stay inside what the fields record. These metadata can show when and where a photo was taken; they cannot show who took it or what is in it.

5Why real data is hard to process

Data sets of any size come with problems. How much a person can get out of data also depends on what they and their tools can do: someone with a spreadsheet and someone who can write a program may get different answers from the same file.

Data that is not uniform. When people type into an open text box, they spell, abbreviate, and capitalize the same thing in different ways. A survey's school column held:

As typedCount
Lincoln HS2
lincoln high1
LHS2
Roosevelt1
Lincoln High School1
roosevelt hs1

Counted as typed, that looks like 6 different schools. Cleaning data makes data uniform without changing its meaning, for example by replacing every equivalent spelling with the same name. After cleaning: Lincoln High School 6, Roosevelt High School 2.

Incomplete data has values missing. Invalid data has values that can't be right, like an age of −1. A program doesn't notice; it computes with whatever it gets:

Ages usedAverageWhat happened
16, blank, −1, 17, 15, 1610.5blank counted as 0 and −1 kept: a meaningless result
16, 17, 15, 1616.0the blank and the invalid value left out

Combining sources is often needed and brings its own problems, as described above.

Bias. Problems of bias often come from the type or source of the data. A traffic study that collects every reading from one quiet neighborhood will say the city's traffic is light. Collecting ten times as many readings from the same neighborhood does not fix that: bias is not removed by collecting more data. Fixing it means changing where the data comes from.

Size. The size of a data set affects how much information can be pulled out of it: six ages show little; six million might show patterns by town and year. But very large data sets are hard to process on one computer and may need many computers working in parallel. Scalability (whether a system can grow to handle more data) affects how a data set can be processed and stored.

The key idea

Information is the facts and patterns pulled out of data. A correlation is not proof of a cause. Combining sources often answers what one source can't. Metadata are data about data, used to find, organize, and manage it, and editing them leaves the data itself alone. Real data must be cleaned, and missing, invalid, or biased data, or data too big for one computer, all make processing harder.

6Worked examples

Worked Example 1 Judge a conclusion

Sleep and grades

A school survey finds that students who report more sleep also report higher grades. Which conclusion does the data best support? (a) More sleep causes higher grades. (b) Students who sleep more tend to have higher grades. (c) The survey tells us nothing.

  1. 1
    The survey shows a correlation, which is real information, so (c) is wrong.
  2. 2
    It does not show a cause: students with lighter workloads might sleep more and also do better, so (a) claims too much.
  3. 3
    (b) reports the relationship and stops.
Answer: (b). Finding out whether sleep causes better grades would take more research.
Worked Example 2 Decide what metadata can tell you

The music library

A music app stores each song's title, artist, length, and date added. Which of these can be found from the metadata alone? (a) the songs added last week; (b) the songs that are in a minor key; (c) the total listening time of an album.

  1. 1
    (a) Date added is a field: filter on it. Yes.
  2. 2
    (b) Key is about the music itself and is not a field. No.
  3. 3
    (c) Add up the length field for the album's songs. Yes.
Answer: (a) and (c). Only questions whose answers come from stored fields can be answered without opening the songs.
Worked Example 3 Name the challenge

Three messy data sets

Name the challenge: (a) a clinic's records leave many weight fields blank; (b) a city's 5 million traffic readings all come from one wealthy neighborhood; (c) a “state” column holds NY, New York, and n.y.

  1. 1
    (a) Missing values: incomplete data. Averages are wrong until the blanks are handled.
  2. 2
    (b) The source is skewed: bias. 50 million readings from the same place would not fix it.
  3. 3
    (c) Same meaning written three ways: not uniform. Cleaning replaces them with one form.
Answer: (a) incomplete data, (b) bias from the data source, (c) data that need cleaning
Worked Example 4 Check what a data set can answer

The purchase table

A store's table has the columns Name, Age, City, Purchase date, Amount. Can you find (a) the total spent by customers from one city last month; (b) each customer's favorite product category; (c) the average age of customers who bought something in March?

  1. 1
    (a) Filter by City and Purchase date, then add up Amount. Yes.
  2. 2
    (b) There is no product column. No.
  3. 3
    (c) Filter by Purchase date, then average Age. Yes.
Answer: (a) yes, (b) no, (c) yes. Every piece of information the answer needs has to be in the table.

7Common mistakes

Common Mistake 1 · Turning a correlation into a cause

“X and Y move together” is supported by the data. “X causes Y” needs more research.

Common Mistake 2 · Thinking editing metadata changes the data

Renaming, retagging, or deleting tags leaves the content untouched. Cropping a photo changes the data itself.

Common Mistake 3 · Fixing bias with more data

More rows from the same skewed source repeat the same bias. Change where the data comes from.

Common Mistake 4 · Cleaning that changes meaning

Cleaning makes data uniform. Replacing “LHS” with “Lincoln High School” is cleaning; deleting every response you disagree with is not.

Describe information from data like this

“Joining the sales and weather data by date shows that ice cream sales tend to be higher on hotter days (125 cones on average at 28 °C or more, 66 on cooler days). This is a correlation; more research would be needed to show that temperature causes the change.”

Name the pattern, give the numbers behind it, and stop at what the data shows.