L16 Can You Trust the Source?

DATA SCIENCE · CYCLE 2 · L16 · TEXTBOOK CHAPTER

Can You Trust the Source?

A big data source nobody can check is a risk. Before you use somebody else’s file, ask who made the data and how. Then run three checks on the data itself: valid, complete and unique.

After this chapter, you can

For your project: your ABOUT tab says who made your file, and how. The checkpoint is at the end.

Why It Matters

On 22 May 2020 The Lancet, a top medical journal, published a study of a malaria drug, hydroxychloroquine, in COVID patients. The data came from one company’s database, Surgisphere. The study used the records of 96,032 patients in 671 hospitals. It linked the drug to more deaths in hospital.

Three days later, on 25 May, the World Health Organization paused its own trial of the drug. A trial is a test of a drug on patients.

Then reporters checked the study against a number anyone could find. The study counted 73 COVID deaths in Australia by 21 April. Australia had recorded 67 by that day.

One of the study’s four authors was the company’s founder. The other three asked outside experts to check the database. The company would not give the experts its full data. On 4 June, 13 days after it was published, the study was retracted. Retracted means taken back.

A big source nobody can check can stop a trial. Ask who made the data, and whether anyone can check it.

The Idea

Who made it, then three checks

A source is reliable when you can check who made the data and how.

The data is ready when it passes three checks:

DS.7’s checkIt asksThe Sheets count
validone type and one format in each column?=COUNT against =COUNTA
completeevery value the question needs?=COUNTBLANK
uniqueno row in the file twice?=COUNTUNIQUE, then Data > Data cleanup > Remove duplicates

The Three Checks on VDOT’s File

In class you ran the three checks on the 2023 traffic file from VDOT, the Virginia Department of Transportation. AADT is its column of traffic counts. Link ID is its id column. An id is a number or code that names one thing, like a student number.

CheckWhat the count found
valid=COUNT found 743 numbers. =COUNTA found 743 filled cells. They match, so the column is valid.
complete=COUNTBLANK found 121 blank AADT cells, 14.0% of its 864 rows. Most are ramps, which VDOT does not count.
unique=COUNTUNIQUE found 647 different Link IDs in 864 rows, so 217 rows repeat a Link ID. Remove duplicates found only 3.

To see the blank rows: Data > Create a filter. Click the filter icon in the column’s header. Clear, tick (Blanks), OK. When you have read them: Data > Remove filter.

A repeated id is not always a repeated row. Link ID 190023 is three pieces of I-66, each starting and ending somewhere else. A duplicate is a row that matches another in every column.

Who Made It

The producer is who made the data. The publisher is who put it out for others to use. For the class file they are the same: VDOT made the counts, and VDOT put the file on data.virginia.gov, where anyone can download it.

Reliable has two meanings here. A reliable source is one you can check: who made the data, and how. A reliable measurement gives about the same number when you measure again. It can still be wrong every time.

The ABOUT Tab for Somebody Else’s Data

Five lines, one in each cell from A1 to A5. This is the tab the class wrote for VDOT’s file.

LineStart withFor VDOT’s file
1Made by:the Virginia Department of Transportation
2Published by:VDOT, on data.virginia.gov
3How:estimates for each section of road, one number a section
4Where and when:VDOT’s Arlington maintenance area, Alexandria too; 2023
5What it misses:121 sections with no count, most of them ramps

The three counts cannot tell you where the roads are. The file covers more than Arlington County: 293 of its 864 rows are in the City of Alexandria. Line 4 says so. A reader needs the ABOUT tab as well as the checks.

Worked Examples

Example 1 · Three checks, three counts. An animal shelter shares its March log, one row for each animal that came in. Row 1 is the header row. Run the three checks.

ABCD
1Animal IDDate inKindWeight (lb)
241073/2/2026dog41
341083/2/2026cat9
441093/3/2026cat11 lb
541103/5/2026dog
641083/9/2026cat10
741113/9/2026rabbit4
841113/9/2026rabbit4
941123/10/2026dog55
Create a strategy

One check at a time, each with its count. Valid: =COUNT and =COUNTA on the weights, D. Complete: =COUNTBLANK on D. Unique: =COUNTA and =COUNTUNIQUE on the id column, A.

Apply the idea
CellTypeIt shows
F2=COUNT(D2:D9)6
F3=COUNTA(D2:D9)7
F4=COUNTBLANK(D2:D9)1
F5=COUNTA(A2:A9)8
F6=COUNTUNIQUE(A2:A9)6

Valid. 6 numbers and 7 filled cells, so 7 − 6 = 1 cell holds text: 11 lb, in row 4.

Complete. 1 blank cell: the dog in row 5.

Unique. 8 − 6 = 2 rows repeat an Animal ID. Rows 3 and 6 share ID 4108, with two dates and two weights: the same cat came in twice. Rows 7 and 8 match in every column: a duplicate.

Reflect and check

A count tells you something is there. You still read the rows and fix them. On a copy of the tab, type 11 in D4 and delete row 8, the duplicate. Each fix gets a row on the LOG tab. Leave D5 blank: nobody weighed that dog, and a 0 would say it weighed nothing. Check the counts against each other: 6 numbers + 1 text + 1 blank = 8 rows.

Try It: Break It, Then Fix It

The lab starts on Example 1’s log. Change a cell and watch the counts follow. Then meet the three goals.

Example 2 · A repeated id, or a duplicate? A bike-share company posts one month of trips: one row a trip, 2,400 rows of data, in columns A to F. Column A is the Bike ID. =COUNTA(A2:A2401) shows 2,400. =COUNTUNIQUE(A2:A2401) shows 180. How many rows are duplicates?

Create a strategy

The rows minus the different ids gives the rows that repeat an id. That count cannot say whether a whole row repeats. For that, copy the tab, then run Remove duplicates on every column of the copy.

Apply the idea

2,400 − 180 = 2,220 rows repeat a Bike ID. That is how this file should look: one bike takes many trips.

  1. Right-click the tab at the bottom of your sheet > Duplicate.
  2. Right-click the copy > Rename > CLEAN.
  3. Click the Name box, left of the formula bar. Type A1:F2401.
  4. Press Return.
  5. Data > Data cleanup > Remove duplicates.
  6. Tick Data has header row.
  7. Click Remove duplicates.

Sheets reports 36 duplicate rows found and removed. 2,400 − 36 = 2,364 rows are left on CLEAN.

Reflect and check

2,220 rows repeat an id, and only 36 repeat a whole row: 36 ÷ 2,400 × 100 = 1.5% of the rows were in the file twice. The first tab still holds all 2,400 rows, because the file as it was published is never changed. The LOG tab gets one row: Remove duplicates, 2,400 rows before, 2,364 after.

Example 3 · The ABOUT tab, and two kinds of reliable. The Statistics Club timed the wait in the lunch line: the main cafeteria, first lunch, 20 school days in October 2026. Two students timed it with a phone stopwatch. The times are in B2 to B21, one number a day, and =COUNTBLANK(B2:B21) shows 3. The front office posted the club’s file on the school website. Write the file’s ABOUT tab. Is the source reliable?

Create a strategy

Five lines, one for each thing a reader will ask: who made it, who put it out, how, where and when, and what it misses. Then one more question: can anyone check it?

Apply the idea
  1. Click + (Add Sheet) at the bottom left.
  2. Right-click the new tab > Rename > ABOUT.
  3. In A1 to A5, type one line each, as in the table.
CellType
A1Made by: the Statistics Club
A2Published by: the front office, on the school website
A3How: two students timed the wait with a phone stopwatch, one number a day
A4Where and when: the main cafeteria, first lunch; 20 school days in October 2026
A5What it misses: second lunch, and 3 days with no number

The source is reliable: you can check who made the data and how. You can ask the club.

Reflect and check

The producer and the publisher differ here. The club made the data, and the office put it out. Is each time a reliable measurement? That is another question. On one day both students timed the same wait, and both got 6 minutes. Measure again, get about the same number: reliable.

The Same in Python

Python comes in L19b. Once you have read it, come back and run Example 1’s id column here. One word is new: .nunique() counts the different values in a column, as =COUNTUNIQUE does in Sheets.

In Sheets this is: =COUNTA(A2:A9) and =COUNTUNIQUE(A2:A9).

In English:

  1. Get the pandas toolbox and call it pd.
  2. Make a column of the eight Animal IDs, and call it ids.
  3. Print how many rows ids has.
  4. Print how many different values ids has.

Predict: two IDs are in the list twice. What will line 4 print?

Can’t run it here? Show what it prints
8 rows 6 different IDs

The same 8 and 6 as F5 and F6 in Example 1.

Want to type your own? The Python practice page has tasks and a notebook.

In your project

Your Cycle 2 project is one Google Sheet with RAW, CLEAN, LOG, ABOUT and ANALYSIS tabs, and a one-page memo. It starts from a file somebody else made. The ABOUT tab names who made the data and how, in Example 3’s five lines. The LOG tab records each fix, as Example 2 does: 2,400 rows before, 2,364 after. Every fix happens on CLEAN. Nothing in RAW is ever changed. Your one-page memo says where the data comes from and who made it. Take that from the ABOUT tab.

Check Yourself

Answer each one before you look. The first one is from an earlier lesson.

File > Download > Comma-separated values (.csv) saves your CLEAN tab out of Sheets as a file. What is that move called? L15

Swim times are in C2 to C76. =COUNTA(C2:C76) gives 75. =COUNT(C2:C76) gives 69. One cell says 31 sec. On CLEAN, you retype it as 31. What does =COUNT(C2:C76) give now?

A column of daily rainfall holds 325 days. =COUNTBLANK finds 26 blank cells. What percent of the days are blank?

A library file has one row for each checkout. Column A is the Book ID. =COUNTA(A2:A1201) gives 1,200. =COUNTUNIQUE(A2:A1201) gives 1,145. Are the rows that repeat a Book ID duplicates?

A city health department counts flu cases each week. A local news site posts the file for its readers. Who is the producer?

The Garden Club measured the height of every sunflower in the school garden in July 2026, with a tape measure. The school posted the file. Which line 3 belongs on the file’s ABOUT tab?

A website posts: teens sleep 6.1 hours a night. It names no author and no method. Is it a reliable source?

Two coaches time one runner’s lap. Both press start 2 seconds late. Both stopwatches read 61 seconds. What do the matching times show?

Project Checkpoint

ABOUT · part of P2, due Fri 18 Dec

A reader trusts your claim only as far as they trust your file. Your ABOUT tab tells them who made it, how and when, and what it leaves out.

Tick each step once it is in your Sheet. Your ticks go into the PDF you hand in. Where everything goes: your Sheet, tab by tab.

Read More

OpenStax, Principles of Data Science, section 2.4: Data Cleaning and Preprocessing. A free college textbook. Read the first part, on missing data, and the part called Data Validation. Missing data is its name for values that are not there: our complete check. Its Data Validation part checks for duplicates, and compares the data with reliable sources.

Stuck on any of this? Ask Mr. Case in class or send him a message in Canvas. Name the example or the question number, and say which step lost you.