DS 227 · Week 9

Data Journalism

Finding stories in data: from a question to a comparison, a chart, and one defensible sentence.

Knowledge Discovery in Data · University of the Philippines Cebu

Outline

From dataset to defensible claim

Key terms

Ten terms used in data journalism

story

A finding that a reader should know, told so that they can check it.

e.g. "48 of 4,841 firms hold 27.6% of the money"

angle

The particular question or point of view a story takes on the data. One dataset has many angles.

e.g. flood data: spending per region, or which firms get the most

comparison

Setting a number next to another group, time or expectation. Most findings are one.

e.g. passers studied 7.0 h; the others 2.4 h

context

The surrounding facts a reader needs to judge whether a number is big, small or normal.

e.g. Region IV-B builds different works than Region I

denominator

The number divided by: the "out of how many" or "per what" behind a figure.

e.g. ₱1.6T ÷ 11 years = ₱145.5B per year

per-capita

Per person: divide a count by the population, so places of different sizes compare fairly.

e.g. 500 cases ÷ 1,000,000 people = 50 per 100,000

base rate

How common something is overall: the reference against which a group is compared.

e.g. 0.4% of all projects are terminated

source

Where the data came from: who produced it and where it was obtained.

e.g. DPWH flood control projects, via the BetterGov.ph mirror

verification

Checking a claim against the evidence before publishing it.

e.g. inspect .unique() on the column a claim rests on

unpopulated column

A column that exists but was never filled in. Its zeros mean "not recorded", not "none", as with amount_paid.

e.g. df.amount_paid.unique() gives array([0])

About the tool

Reporters have analysed data with computers since 1952

1952

UNIVAC

CBS uses a UNIVAC I computer to analyse US presidential election returns.

1967

Detroit

Philip Meyer surveys residents after the Detroit riot and analyses it on a mainframe.

1973

The book

Meyer’s Precision Journalism teaches reporters social-science methods.

2001

Newsrooms

Computer use reaches “critical mass” in American newsrooms.

SourceWikipedia: Computer-assisted reporting; Philip Meyer; Columbia Journalism Review

About the tool

What the early data stories found

SourceWikipedia: Computer-assisted reporting; Wikipedia: Philip Meyer

Runnable code

Code on these slides runs in the browser

As in weeks 6 to 8, a block with a ▶ Run / Edit button runs in the browser and can be changed. This week’s small examples (ten students, two towns) run there; the flood checks run in the companion notebook.

Templates are not code

Some blocks show text to copy into a story: a caption, a correction note, interview questions. They have no Run button and are not part of the notebook.

import io, sys print("pandas version:", pd.__version__) print("64-bit Python:", sys.maxsize > 2**32) t = pd.read_csv(io.StringIO("city,pop\nCebu,964000")) print(t.dtypes) pandas version: 3.0.5 64-bit Python: True city str pop int64 dtype: object
  • pd.__version__the installed pandas: 3.0.5 on the laptop, 2.2.0 in the browser
  • t.dtypeseach column’s type: str on the laptop, object in the browser
Part A

Stories in data

Data stories predate the term "data science".

Six previous weeks covered collecting, cleaning and exploring data. This part examines what turns a pattern into a story that others should read.

Historical example

1854: John Snow's cholera map

"During London's cholera outbreak, John Snow plotted each death as a mark on a street map. The marks clustered around one water pump on Broad Street. The prevailing theory held that disease traveled by air; the map indicated water, and the pump handle was removed."
One question, one dataset, one chart
Historical example

The map: 578 deaths around one pump

Street map of Soho, London, 1854, with 578 small red dots for cholera deaths and 13 dark squares for water pumps. The dots cluster tightly around one larger blue square, the Broad Street pump. Title: 359 of 578 deaths are nearest the Broad Street pump.
Types of data story

Three types of data story

Types of data story

The three types, drawn from the flood data

Three panels. 1, the uncounted: the number 34,079 flood-control projects counted in one table. 2, the contrast: median duration 167 days in Region I against 260 days in Region VI. 3, the change: projects started per year, rising from 1,820 in 2016 to 5,553 in 2024.
Angles

Choosing an angle before a chart

Angles

One dataset, three angles, three charts

Three charts from the same flood data. Place: median project duration for 18 regions, with Region VI at 260 days and Region I at 167 highlighted. Recipients of funds: the top 48 firms hold 27.6% of all money, the other 4,793 hold 72.4%. Unfinished work: 80.8% of projects are done and 16.0% on-going.
Research question

A story starts with a question, not a dataset

An undirected search of a CSV produces noise. The question "Does study time relate to passing?" names an outcome and a suspected driver, which gives every step a direction.

The outcome is the quantity to be explained (passing); the driver is the suspected explanation (study hours). A boolean column holds only True or False.

A good question names

The outcome of interest (passing) and the candidate explanation (study hours).

Shaping the data to the question

The lab converts score into a boolean passed. The question becomes simpler, at the cost of detail (a 74 and a 40 both become "failed").

Stating trade-offs

Every simplification is open to criticism, so the analyst should state it first.

Research question

Turning score into passed: what the yes/no column keeps and loses

Number line of scores from 40 to 100 with a dashed cut at 75. The ten students' scores appear as dots: five red dots below 75 (A, G, C, E, I) labelled passed = False, five green dots above (J, B, F, D, H) labelled passed = True. Two grey diamonds at 74 and 40 show that both become False.
Five false claims from earlier weeks

All from the same dataset

Weeks 4 through 8. Each resulted from a single unchecked operation.

Earlier errors

A plausible but false claim in each week

WeekPlausible claimWhy it was false
4₱1.17T of work completed but never paidamount_paid is 0 on every row — unpopulated, not unpaid
599.6% of flood projects are completedropna() deleted every unfinished project; the real figure is 80.8%
6One project finished 17 days before it startedTrue, but it reflects a data error, not misconduct
7Projects take a median of 202 daysdescribe() silently excluded 6,415 unfinished ones
8Latitude strongly predicts longituder = −0.785 reflects the shape of the archipelago
Case study

The flood data, loaded from the course API

The checks in Part A and the findings in Part C use the 34,079 flood control projects from weeks 4 to 8.

Why not pd.read_csv(url)?

pandas downloads with urllib, which this site’s bot protection answers with 403 Forbidden. requests gets through.

The browser cannot download the data, so the flood blocks have no Run button; the companion notebook runs them.

import io, requests url = "https://portal.latarak.com/api/flood/export.csv" resp = requests.get(url, timeout=60) df = pd.read_csv(io.StringIO(resp.text)) print(df.shape) (34079, 15)
  • requests.get(url)download the whole table in one request
  • (34079, 15)34,079 projects, 15 columns
Case study

What is in the table: 34,079 rows, 15 columns

Diagram of the flood dataset's 15 columns in four groups. Money: budget, and amount_paid in red with the note 0 on every row. Time: start_date, completion_date, year, progress. Place: region, province, latitude, longitude. Who or what: contractor, contract_id, description, category, status.
The amount_paid column

One look at the values shows the problem

Two charts. Left: the budget column's histogram, with many different values from 0 to 300 million pesos. Right: the amount_paid column's values: a single red bar at 0 covering all 34,079 rows.
The amount_paid column

A column of zeros does not mean "unpaid"

The flood data has an amount_paid column. Summing the budgets of completed projects and seeing that amount_paid is 0 suggests ₱1.17 trillion "completed but never paid". However, the column is unpopulated: it exists, but was never filled in.

A blank "tip" line on a receipt does not show that no tip was given, since the restaurant may not record tips on receipts.

A ten-second check

Before a claim rests on a column, its .unique() values should be inspected. One value on every row means "not recorded" until shown otherwise.

print(df.amount_paid.unique()) print(df.amount_paid.sum()) # the tempting "scandal" number, in PHP trillions print(round(df[df.status == "Completed"].budget.sum() / 1e12, 2)) [0] 0 1.17
  • .unique()every different value in the column: here only 0
  • array([0])a NumPy array holding one value: every one of 34,079 rows says 0
  • df[df.status == "Completed"]keep the completed projects, then add up their budgets in trillions
Pattern

The most newsworthy claim needs the most checking

Of the five claims, the ₱1.17 trillion figure was the most newsworthy. It was also the furthest from the truth.

Newsworthiness as a warning sign

A finding that resembles a headline requires more checking than a mundane one, not less, because its appeal encourages skipping verification.

# the check that would have saved each one df.amount_paid.unique() # week 4 len(df), len(clean) # week 5 df.duration.min() # week 6 df.duration.describe()["count"] # week 7 why_would_these_relate() # week 8 # none took more than ten seconds
  • df.amount_paid.unique()list every different value in the column: one value only means nothing was recorded
  • len(df), len(clean)row count before and after cleaning: how many rows were dropped
  • why_would_these_relate()not real code: a question for the analyst
Break

  Five minutes

Next: building the finding step by step.

Part B

Method

Question → comparison → chart → sentence.

Grouping and summarising were covered in weeks 5–8. This part turns a group comparison into a chart and one sentence a reader can check.

The small table

Ten students, two sections

Part B builds a finding step by step on a table small enough to check by eye: the lab’s ten students, their study hours, section and score. A score of 75 or more is a pass.

  • students["score"] >= 75a True/False column: did the student pass?
  • studentsthe lab calls this table df; here the name is kept for the flood data
students = pd.DataFrame({ "student": list("ABCDEFGHIJ"), "study_hours": [1, 6, 2, 8, 3, 7, 2, 9, 4, 5], "section": ["A", "A", "B", "B", "A", "B", "A", "B", "A", "B"], "score": [58, 84, 61, 96, 66, 90, 60, 98, 72, 80], }) students["passed"] = students["score"] >= 75 print(students) student study_hours section score passed 0 A 1 A 58 False 1 B 6 A 84 True 2 C 2 B 61 False 3 D 8 B 96 True 4 E 3 A 66 False 5 F 7 B 90 True 6 G 2 A 60 False 7 H 9 B 98 True 8 I 4 A 72 False 9 J 5 B 80 True
Exercise · 3 min

Turn the question into a comparison

The rows are split by the outcome, and the candidate driver is summarized in each group. One groupby gives the question numerical answers.

The data: 10 students with their weekly study hours and a passed column (True if the score was 75 or more).

Tasks

  1. Predict the average study hours of the students who passed.
  2. Select ▶ Run / Edit and run the code.
  3. Change the pass mark to 85 (students["score"] >= 85 on the table slide) and run again. How do the groups change?

Result on the lecture laptop (select to reveal)

Passed: 7.0 hours on average (5 students); failed: 2.4 hours (5). With a pass mark of 85 only 3 students pass; they average 8.0 hours, and the other 7 average 3.3.

# students: the ten students from the table slide print(students.groupby("passed")["study_hours"].agg( ["mean", "min", "max", "count"]))
  • .groupby("passed")["study_hours"]split the students by result, then look at study hours
  • .agg(["mean", "min", "max", "count"])four summaries per group; count says how many students each number rests on

Reading the whole row

Beyond the means, the ranges do not overlap, and count indicates how much weight the claim can bear (little, at 5 per group).

Output

Each student's hours, split by passing

Two rows of dots on a scale of 0 to 10 study hours. Passed: students J, B, F, D and H at 5 to 9 hours, mean 7.0. Failed: A, C, G, E and I at 1 to 4 hours, mean 2.4. An arrow between the means is labelled gap 4.6 h.
₱1.6 trillion

Scale requires a reference

Neither the analyst nor the reader can judge its size without a denominator.

Denominators

₱1.6 trillion, divided two ways

Two charts. Left: total budget per year from 2016 to 2026 in billions of pesos, rising from 52.6 in 2016 to 369.3 in 2024, with a dashed line at the 11-year average of 145.5 billion. Right: budget per project by region, from Region I at 31.2 million pesos to Region IV-B at 67.1 million and Central Office at 242.0 million.
Denominators

A figure needs a reference for comparison

₱1.6 trillion is the headline figure for this dataset. On its own it cannot be interpreted. A denominator is the quantity a figure is divided by to make it comparable: per year, per project, per person.

Dividing by time

The data covers eleven years. ₱145.5B per year is easier to grasp and can be compared with other budget lines.

print(round(df.budget.sum() / 1e12, 2)) # PHP trillion, 2016-2026 print(df.year.nunique()) # years print(round(df.budget.sum() / 1e9 / 11, 1)) # PHP billion per year 1.6 11 145.5
  • df.budget.sum() / 1e12add every budget; 1e12 is a trillion, so the answer is in trillions (round keeps 2 decimals: 1.60 prints as 1.6)
  • df.year.nunique()how many different years appear: 11 (2016 to 2026)
  • … / 1e9 / 11in billions (1e9), then divided by 11 years
Choice of denominator

Three denominators for ₱1.6T

Exercise · 3 min

Counts versus per-capita rates

Per-capita means "per person". Dividing a count by the population makes places of very different sizes comparable. The numbers on the right are invented to illustrate the arithmetic.

The count and the rate disagree

City A has 12 times as many reports, yet Town B has the higher rate: 80 against 50 per 100,000 people. A headline based on the count would identify the wrong place.

A family of eight eating eight kilos of rice a week eats less per person than a couple eating three.

Tasks

  1. Predict which place has more reports per 100,000 people.
  2. Select ▶ Run / Edit and run the code.
  3. Change Town B’s reports from 40 to 30. Does it still lead?

Result on the lecture laptop (select to reveal)

Town B: 80 reports per 100,000 people against City A’s 50, although City A has 500 reports and Town B 40. With 30 reports, Town B has 60 per 100,000: still ahead of City A.

# made-up example: flood reports and population reports = pd.Series({"City A": 500, "Town B": 40}) people = pd.Series({"City A": 1_000_000, "Town B": 50_000}) print(reports / people * 100_000) # reports per 100,000 people
  • pd.Series({"City A": 500, …})a Series built from a dictionary: the names become the row labels
  • reports / peoplepandas lines the two Series up by label and divides City A by City A, Town B by Town B
  • * 100_000reports per 100,000 people, an easier number to read than 0.0008
  • dtype: float64the results are decimal numbers
Output

The count and the rate pick different leaders

Two bar charts of invented numbers. Left, count of flood reports: City A 500, Town B 40. Right, reports per 100,000 people: City A 50, Town B 80.
Context

Twice the mean, yet the projects overlap

Box plots of budget per project for Region IV-B and Region I, 0 to 160 million pesos. Region IV-B's box is wider and its mean, 67.1 million, is about twice Region I's 31.2 million, but the two boxes overlap heavily. A note says 99.4% of all projects share one category, so the type of work is not in the data.
Context

Context for a comparison

Region IV-B spends ₱67.1M per project; Region I spends ₱31.2M. The twofold difference means little without knowing what kind of projects each builds. This is context: the surrounding facts a reader needs to judge whether a number is big, small or normal.

A difference is not yet a story

Bigger rivers, denser cities, and different works all produce different unit costs legitimately. The comparison generates the question; it does not answer it.

g = df.groupby("region").agg( n=("contract_id", "count"), total=("budget", "sum")) g["per_project"] = g.total / g.n top = (g.per_project / 1e6).round(1).sort_values(ascending=False) print(top.iloc[[0, 1, 2, -1]]) # PHP millions region Central Office 242.0 Region IV-B 67.1 Region XIII 61.0 Region I 31.2 Name: per_project, dtype: float64
  • n=("contract_id", "count")a new column n: how many projects each region has
  • total=("budget", "sum")a new column total: the region's summed budget
  • g.total / g.ndivide one column by the other, row by row: average budget per project
  • top.iloc[[0, 1, 2, -1]]in millions, biggest first; show the top three and the last one (−1)
Step 2

Charting the contrast honestly

A bar chart of the two means makes the gap visible immediately. Bars encode length, so the y-axis must start at zero; a truncated bar chart misrepresents proportion.

# students: the ten students from the table slide import matplotlib.pyplot as plt means = students.groupby("passed")["study_hours"].mean() fig, ax = plt.subplots() ax.bar(["failed", "passed"], means) ax.set_ylabel("Avg study hours") plt.show()
  • students.groupby("passed")["study_hours"].mean()the two averages: 2.4 and 7.0 hours
  • ax.bar(["failed", "passed"], means)two bars that start at zero, so their heights compare honestly

Chart follows claim

The chart exists to carry this comparison, not to decorate. A chart that needs a paragraph of explanation shows that the comparison is not yet precise.

Output

Two bars from zero: 2.4 hours against 7.0

the y axis starts at 0, so the passed bar is almost three times as tall as the failed bar (7.0 against 2.4), and the visual proportion is accurate. The data are the lab’s ten students.

Bar chart with two bars labelled failed and passed: failed reaches 2.4 average study hours and passed reaches 7.0, on a y axis labelled Avg study hours that starts at 0.
Worked example

One sentence: claim, number, caveat

The sentence passed avg 7.0h vs failed avg 2.4h (gap 4.6h, n=10), with three brackets beneath it: the first part labelled claim, who differs and how; gap 4.6h labelled number, the size; n=10 labelled caveat, how much evidence.
Worked example

The finding as one sentence

Claim + number + caveat. A caveat is the stated limit attached to a claim ("only 10 students"). A result that cannot be stated in one sentence is not yet a finding; it is an area of interest.

# students: the ten students from the table slide g = students.groupby("passed")["study_hours"].mean() print(f"passed avg {g[True]:.1f}h vs failed avg {g[False]:.1f}h " f"(gap {g[True] - g[False]:.1f}h, n={len(students)})") passed avg 7.0h vs failed avg 2.4h (gap 4.6h, n=10)
  • f"… {g[True]:.1f}h …"an f-string (week 2) writes the numbers into the sentence, so the sentence cannot drift from the data
  • n={len(students)}say how many observations the finding rests on

The sentence

"Students who passed studied about 4.6 hours more per week on average — though with only 10 students, this is suggestive, not conclusive."

Structure

Claim (studied more) · number (4.6h, n=10) · caveat (suggestive). All three are required.

Caveats

The caveat as a statement of accuracy

"An overclaimed finding is reported briefly and then publicly corrected. A precisely stated finding is cited. 'Suggestive, not conclusive' is not timidity; it states the strength of the evidence."
A claim states what the data supports and no more.
Caveats

Four verbs, four levels of evidence

A row of four boxes of increasing height, each a verb: is associated with (a pattern in the data), suggests (a pattern that survives checks), shows (a controlled comparison or experiment), proves (rarely claimed with data). An arrow above reads stronger verb, more evidence needed. A dashed outline around the first two reads most EDA findings live here.
Review question

Question (select to reveal the answer)

Which is the defensible version of the lab's finding?

A · "Studying makes students pass."
B · "Study time matters a lot."
C · "Passers studied ~4.6h more on average (n=10) — suggestive, not conclusive."
D · "100% of high scorers studied, proving effort is everything."

C: claim, number, caveat.

A is causal (the data is observational); B has no number; D overclaims from a sample of ten. C says exactly what was measured, how big it was, and how much to trust it.

Part C

Standards

Testing a story before publication.

Part B built a finding. This part tests it against other explanations, other framings, misleading charts, and a real finding that could harm real companies.

Test 1

Section B studies more and passes more

Scatter of the ten students, study hours across and score up, with a dotted pass mark at 75. Section A students are orange circles, mostly low on both axes; section B students are blue squares, mostly high. Legend: section A studied 3.2 hours on average and 20% passed; section B studied 6.2 hours and 80% passed.
Test 1

Checking for a confounder

Week 8 showed that a third variable (a confounder) can drive both of two variables, here study time and passing. Suppose the ten students came from two class sections, A and B.

# students: the ten students from the table slide print(students.groupby("section")["passed"].mean()) section A 0.2 B 0.8 Name: passed, dtype: float64
  • students.groupby("section")["passed"].mean()the pass rate in each section: the mean of True/False is the share that is True
  • A 0.2, B 0.81 of 5 passed in section A, 4 of 5 in section B: section may explain both study time and passing

A possible confounder

Section B both studies more and passes more, possibly because of a different instructor or exam. Until section is separated from study time, "study more, pass more" is weakly supported.

Exercise · 3 min

Robustness under a different framing

A sound finding holds under a different cut of the same data (it is robust). Here the pass rates of high- and low-study students are compared instead of mean hours.

Tasks

  1. Predict the pass rate of the students who studied 5 hours or more.
  2. Select ▶ Run / Edit and run the code.
  3. Change the cut-off to 4 hours (>= 4). Does the finding survive?

Result on the lecture laptop (select to reveal)

1.0: every student with 5 or more hours passed, and none below. With a cut-off of 4 hours, the high-study group’s pass rate falls to 0.83 (5 of 6): weaker, but the direction holds.

# students: the ten students from the table slide students["high_study"] = students["study_hours"] >= 5 print(students.groupby("high_study")["passed"].mean())

Two framings, same direction

The mean gap and the pass rate agree here, which supports the finding. A result that reverses under a different cut is an artifact of one framing, not a finding.

Output

The finding survives a second cut

Two pairs of bars of pass rate. Cut at 5 hours: 0% of the 5 students under 5 hours passed, 100% of the 5 at 5 hours or more. Cut at 4 hours: 0% of 4 under, 83% of 6 at 4 or more. Caption: weaker at 4 hours, 5 of 6 pass, but the direction holds: robust.
Test 3

Misleading charts with accurate numbers

Test 3

Accurate numbers, misleading charts

Six small charts in three pairs. Truncated bars: the same 90 and 95 drawn from 88 look 3.5 times different, drawn from 0 look nearly equal. Cherry-picked window: flood projects started fell from 3,807 in 2018 to 2,923 in 2019, a 23% fall, but the full 2016 to 2025 series rises. Counts vs rates: City A has the most reports, but Town B has the higher rate per 100,000.
Case study

A finding that could harm named companies

131 contractors, PHP 75.2 billion, and a marker in their names.

Finding

131 firms, 1,263 projects, ₱75.2 billion

Some contractor names in the source export (the file the agency produced) contain the token (marker text) [REVOKED]. Counting them takes one line of code, and the total is substantial.

4.7% of all awarded value

Out of 4,841 contractors and ₱1.6 trillion. The share is large enough to merit study and to cause harm if framed incorrectly.

rev = df[df.contractor.str.contains("REVOKED", na=False)] print(rev.contractor.nunique()) # firms print(len(rev)) # projects print(round(rev.budget.sum() / 1e9, 1)) # PHP billions print(round(rev.budget.sum() / df.budget.sum(), 3)) # share of all money 131 1263 75.2 0.047
  • df.contractor.str.contains("REVOKED", na=False)True for each row whose contractor name contains the text; na=False treats missing names as False
  • df[ … ]keep only those rows: rev is the flagged projects
  • rev.contractor.nunique()how many different firms: 131
Base rate

2.7% of firms, 3.7% of projects, 4.7% of the money

Three bars for the firms flagged [REVOKED]: 2.7% of contractors (131 of 4,841), 3.7% of projects (1,263 of 34,079) and 4.7% of the money (75.2 billion of 1.6 trillion pesos).
Base rate

4.7% of the money compared with the base rate

A base rate is how common something is overall: the reference against which a group is compared. The flagged firms are 2.7% of all contractors and hold 3.7% of the projects, but 4.7% of the value.

What it does and does not say

Their projects are larger than average: 3.7% of the projects carry 4.7% of the value. That is a question to report, not evidence of wrongdoing.

Whether 3 left-handers in a group of 10 is unusual depends on knowing that about 1 person in 10 is left-handed. That "1 in 10" is the base rate.

# rev: the projects of revoked firms (the Finding slide) print(round(rev.contractor.nunique() / df.contractor.nunique(), 3)) # share of firms print(round(len(rev) / len(df), 3)) # share of projects print(round(rev.budget.sum() / df.budget.sum(), 3)) # share of money 0.027 0.037 0.047
  • revthe 1,263 projects of the 131 flagged firms (the Finding slide)
  • nunique() / nunique()131 flagged firms out of 4,841 firms; round(…, 3) keeps 3 decimals
  • len(rev) / len(df)1,263 projects out of 34,079
Headline wording

Testing a headline against the evidence

✗ "₱75 billion awarded to contractors with revoked licences"

Every number in it is correct. It is still not a claim this data supports, and it names real companies.

What it implies

That the licence was revoked when the project was awarded. Nothing in the dataset says that.

✓ "131 firms holding ₱75.2B in contracts are flagged as licence-revoked in the DPWH export"

States what the data records, and when. A reader can check it and knows its limits.

What changed

The verb. "Awarded to firms with revoked licences" asserts a sequence. "Flagged as revoked in the export" asserts a record.

What the token records

Two dates in the data, and none for the licence

A time line with three marked points: start_date and completion_date, joined by a shaded bar, and later the file export, where the [REVOKED] marker is seen. Three red question marks, before the start, during the work and after completion, show possible revocation times; the text reads: licence revoked before the award, during the work, or after? No column records it.
What the token records

Licence status at export time only

[REVOKED] is part of the contractor name string in the source. It is a snapshot of that firm’s licence when the file was produced.

Three things it does not record

When the licence was revoked. Whether it was revoked before or after these awards. Whether any of these particular projects was irregular.

# how a revoked licence appears in the data print(rev.contractor.iloc[0]) # which columns hold a date? print([c for c in df.columns if "date" in c]) ST. TIMOTHY CONSTRUCTION CORPORATION ([REVOKED] 39196) ['start_date', 'completion_date']
  • rev.contractor.iloc[0]a revoked firm’s name carries the marker [REVOKED] and a licence number
  • [c for c in df.columns if "date" in c]the only dates are a project’s start and completion: there is no revocation date, so “awarded after revocation” cannot be measured
Three questions before naming anyone

The three questions applied to this finding

Verification

The pre-publication checklist

Verification means checking a claim against evidence before publishing it. Journalists verify sources; data journalists verify pipelines (every step from raw file to final number). The practices from weeks 3–6 are the verification.

Data source

Its origin, who collected it, and what it does not cover, stated plainly.

Reproducible work

Reproducible code from raw file to final chart (week 5's rules). An unexplained result is not a methodology.

Alternative explanations

Other explanations are identified and checked before publication, not left for critics to find.

A supported claim

48 of 4,841 contractors hold 27.6% of the money

0% 25% 50% 75% 100% 0 1,000 2,000 3,000 4,000 4,841 the top 48 contractors (1%) hold 27.6% of the money Contractors, largest total budget first (4,841 in all) equal shares share of all flood-control money
Concentration, computed

Concentration: a claim with verifiable numbers

Setting the licence question aside, this finding contains no ordering assumption and no accusation. Concentration means a few players hold most of something.

48 firms, 27.6% of the money

Out of 4,841 contractors. This is a structural fact about the market, directly measurable, and it accuses no one.

c = (df.groupby("contractor").budget.sum() .sort_values(ascending=False)) print(len(c)) # contractors print(round(c.head(48).sum() / c.sum(), 3)) # the top 1% print(round(c.head(10).sum() / c.sum(), 3)) # the top 10 4841 0.276 0.1
  • groupby("contractor").budget.sum()total budget per firm
  • .sort_values(ascending=False)biggest firm first
  • c.head(48).sum() / c.sum()the top 48 firms' total as a share of everything: 0.276 = 27.6%
Count and rate

131 terminated projects: concrete as a count, small as a rate

Horizontal bars of project status: Completed 80.8% (27,534), On-Going 16.0% (5,442), For Procurement 2.6% (876), Terminated 0.4% (131), Not Yet Started 0.3% (96).
Count and rate

Terminated projects: 131, or 0.4%

"131 flood control projects terminated" is true and sounds alarming. "0.4% of all projects" states the same fact and suggests a functioning system.

Report both

The count makes it concrete; the rate makes it fair. Reporting only one can mislead the reader.

print((df.status.value_counts(normalize=True) * 100).round(1)) status Completed 80.8 On-Going 16.0 For Procurement 2.6 Terminated 0.4 Not Yet Started 0.3 Name: proportion, dtype: float64
  • value_counts(normalize=True)the share of projects in each status (shares add to 1)
  • * 100turn shares into percentages: 0.808 becomes 80.8
Sourcing

The five lines under every chart

The concentration curve (48 of 4,841 contractors hold 27.6% of the money) with a five-line caption underneath: source, scope 2016 to 2026, n = 34,079 contracts, method, accessed 2026-09-20. Arrows label each line dataset, scope, n, method and date.
Sourcing

Four facts that make a claim verifiable

A source is where the data came from: who produced it, and where it was obtained. A reader who cannot reproduce a number must accept it on trust; four short facts remove that need. (CC0 means the data is free to reuse; a mirror is a copy hosted elsewhere.)

Placement under the chart

Not in an appendix. The reader who needs it is looking at the figure, not the methodology section.

# the caption that makes it checkable Source: DPWH flood control projects, 2016-2026, via BetterGov.ph mirror (CC0). n = 34,079 contracts. Budget summed by contractor; figures in PHP as recorded. Accessed 2026-09-20. # dataset, scope, n, method, date. # five lines. every published figure.
Pre-publication checklist

Checks from weeks 4–9 in one pass

CheckFromWhat is checked
Column meaning confirmedweek 4.unique() inspected on the field the claim rests on
Dropped rows knownweek 5Row count before and after, and which rows were removed
Derived values are possibleweek 6Min, max, and the number of impossible values
Denominator knownweek 7count compared with len(df); any difference stated
Relationship survives splittingweek 8Holds within regions, not only on average
Verb matches the evidenceweek 9No sequence asserted that the data cannot order
Reproducible by othersweek 9Source, scope, n, method, date — under the chart.
Worked example

Finding, number, method, limit

PartThe sentence
FindingFlood control contracting is concentrated: 1% of contractors hold over a quarter of the awarded value.
Number48 of 4,841 firms account for 27.6% of ₱1.6 trillion; the largest single firm holds ₱28.85B across 242 projects.
MethodSummed budget by contractor over 34,079 DPWH projects, 2016–2026, from the BetterGov mirror (CC0).
LimitConcentration is not evidence of wrongdoing. Large firms win large contracts; this measures structure, not conduct.
Limits of the dataset

Questions the dataset cannot answer

QuestionWhy the data cannot reach it
Was this project good value?No quality, inspection or outcome field exists. Budget is not worth.
Was money misused?amount_paid is unpopulated. There are no disbursement records here at all.
Did flooding actually decrease?No flood-incidence data is joined. The dataset describes spending, not effect.
Was a licence revoked before the award?No revocation date. The token is a snapshot at export time.
Who decided each award?No procurement or approval fields. The decision process is not recorded.
Reporting

The pattern is a question to take to the agency

Overlapping histograms of project duration for Region I (2,730 projects, teal) and Region VI (881 projects, orange), 0 to 1,000 days. Vertical lines mark the medians, 167 and 260 days, with an arrow labelled 93 days between them. Region VI's distribution sits further right.
Reporting

The data raises the question; a person answers it

"Region VI’s median project takes 93 days longer than Region I’s" is not a story yet. It is a good question to put to the agency, an engineer, or a contractor.

The step that makes it journalism

Analysis stops at the pattern. Reporting takes the pattern to someone who knows why, and publishes their answer alongside it — including when they decline to comment.

# what you bring to the interview - the number (93 days) - the method (median duration by region, n=881 and n=2,730) - the date range (2016-2026) - what you are NOT claiming ("this is not an accusation of delay or mismanagement") # a precise question gets a real answer. # a vague one gets a press release.
Correction policy

Accuracy as an ongoing process

Errors are inevitable. A credible outlet differs from a discredited one in how it handles them.

Location of data and code

A link to the notebook is the clearest signal that the work is open to checking, and it allows errors to be found while they are still small.

# publish alongside every data story Data: DPWH flood control projects, 2016-2026, BetterGov mirror (CC0) Code: github.com/.../analysis.ipynb Contact: <an actual address> Corrections: any change to a figure is logged at the foot of this page with the date and what changed. # five lines. it is the difference # between a claim and journalism.
Limits as part of the finding

A limit is not a disclaimer added at the end

A caveat added last reads as a retreat. A caveat written into the claim reads as precision and keeps a careful reader from dismissing the whole piece.

Hedging vs accuracy

"May possibly suggest" is hedging. "Measures structure, not conduct" is accuracy. The first weakens a claim; the second defines it.

# weak — sounds unsure of itself "This might possibly indicate some kind of irregularity, perhaps." # strong — sure, and precise "48 firms hold 27.6% of awarded value. Concentration is not evidence of wrongdoing; it is a question worth asking the agency."
Exercise · 8 min

Developing a finding from start to finish

1 · Find a pattern

Any pattern in the flood data: by region, by year, by contractor, by duration.

2 · Write the four parts

Finding, number, method, limit. One sentence each, using the earlier table as a template.

3 · Critique

Exchange sentences with a neighbour and identify the unstated assumption in each. Every claim has one.

4 · Rewrite

Fix the verb, not the number. Most bad claims are a correct figure attached to an overreaching verb.

Review question

Question (select to reveal the answer)

131 contractors with "[REVOKED]" in their names hold ₱75.2B in projects. Which headline does this dataset support?

A · "₱75 billion awarded to firms with revoked licences"
B · "131 firms holding ₱75.2B in contracts are flagged licence-revoked in the DPWH export"
C · "Government ignored revoked licences worth ₱75 billion"
D · "4.7% of flood control spending went to unlicensed contractors"
B. The token records licence status at export time, inside the name string. There is no revocation date, so the ordering that A, C and D all assume — revoked first, awarded second — cannot be checked. B states what was recorded and when. Same numbers; only B is a measurement rather than an accusation.
Review question

Question (select to reveal the answer)

Which of the five near-misses from weeks 4–8 would have been the most damaging to publish, and why?

A · The −17 day duration — it is obviously impossible
B · The ₱1.17T "completed but never paid" — it was the most exciting, so least likely to be checked, and it names real firms
C · The latitude/longitude correlation — the strongest coefficient
D · The 202-day median — it affects the most rows
B. The damage of a false claim scales with how eagerly it is shared and who it names. The ₱1.17T figure was a trillion-peso accusation about real companies, resting on a column that was never populated. A was self-evidently a data error; C would not be published; D is a caveat, not an accusation.
Review question

Question (select to reveal the answer)

Draft headline: "Studying CAUSES passing, data shows." Based on the lab's 10-student comparison. What is wrong with it?

A · Nothing — the gap was large
B · Causal claim from observational data, tiny n, and an unchecked section confounder
C · Only that it should say "students"
D · Headlines cannot contain the word "data"

B: three errors in seven words.

No one randomized study hours (so no causal claim), ten students cannot support "shows," and Part C found section B passing at 4× section A's rate. An accurate headline: "Passing students studied more — small sample, cause unclear."

Glossary

This week's terms, one line each

Finding the story

data journalism
reporting news whose evidence is a dataset
story
a finding a reader should know, told so they can check it
angle
the particular question a story takes on its data
comparison
a number set next to another group, time or expectation
context
surrounding facts that show if a number is big or normal
denominator
the quantity divided by: per year, per project, per person
per-capita
per person: count ÷ population
base rate
how common something is overall; the reference
caveat
the honest limit attached to a claim
outcome / driver
what is explained / the suspected explanation

Checking the story

source
who produced the data and where it was obtained
verification
checking a claim against evidence before publishing
unpopulated column
exists but never filled in; amount_paid is 0 on every row
confounder
a third variable that drives both compared variables
robust
still holds when the data is divided another way
truncated axis
bars not starting at zero: exaggerates gaps
cherry-picking
choosing the window or cases that suit the claim
concentration
a few players holding most of something
export / token
the file an agency produced / marker text inside a field
correction policy
a public promise to log and fix errors
observational data
recorded as it happened; shows association, not cause
defamation
a false published claim that damages a reputation
This week's lab

Building a defensible finding

Ten students, a pass/fail outcome, and a suspected driver. The lab covers the comparison, its chart, and the one-sentence finding with number and caveat. ~45 minutes.

Lab tasks

Turning a score into a pass flag, groupby() comparisons with a size and an n, a zero-based bar chart, and the claim–number–caveat sentence.

Optional extension

Rates versus counts, and a check for a third variable (tutoring) that could explain the gap.

Summary

Four main points

Readings

Preparation for next week

Next week

Data storytelling

Narrative, dashboards and communication: presenting a finding to an audience with thirty seconds and no context.

DS 227 · Knowledge Discovery in Data