Getting and cleaning data · lesson 1 of 11
Parts in this lesson
ACC BY 4.0use it, and say where it came from
Bcodebookwhat each column means

Where data comes from

Last updated

So far the data has come with the course. Real analysis starts by finding data, and deciding whether to trust it and whether you may use it. In this lesson you'll meet the open data sources for the Philippines and the world, read a licence, and fill in a data source card before you load a single row.

By the end of this lesson you can

  • Name open data sources for the Philippines and the world
  • Read a licence and say what it lets you do
  • Fill in a data source card: who collected the data, how, when and why

Open data sources

Open data is data published for anyone to use. For the Philippines, start with:

  • PSA OpenSTAT, from the Philippine Statistics Authority: population, prices, wages, farm production and more, by region, province and year. Tables download as CSV or Excel.
  • Open Data Philippines (data.gov.ph): datasets from government agencies.
  • PAGASA, the weather service: rainfall, temperature and typhoon records.

For comparing countries, the World Bank (data.worldbank.org) has thousands of indicators for every country, over decades.

Two habits when you search:

  • Go to the source. A chart on social media, or a table copied into a blog, has lost its definitions and may have been changed. Find the agency that collected it.
  • Download the raw file, and keep it. Save it in data/raw/ with the date you got it (lesson 1.5). Official tables are sometimes revised, and you'll want to know which version you used.

Licences and terms

Every dataset comes with terms: a licence, saying what you may do with it. Many open datasets use a Creative Commons licence, built from a few parts:

partmeans
BYcredit the source
SAshare what you make under the same licence
NCnon-commercial use only
NDno changed versions

The Tindahan report is paid work for the shops' owner. Sort each dataset by what you may do with it:

0 of 6 placed right

  1. CC0: “No rights reserved”

  2. CC BY 4.0

  3. CC BY-SA 4.0

  4. CC BY-NC 4.0

  5. A website table with no licence, and “All rights reserved” at the bottom

  6. A spreadsheet of customers’ names and phone numbers, shared by a friend

"Credit" means a line in the report, like: Rainfall: PAGASA, downloaded 1 March 2024. Put the same line in your notebook's first note.

Who, how, when and why

Before you load a dataset, fill in a data source card. It takes five minutes, and it often decides whether the data can answer your question at all. Here's one for the Tindahan sales data:

WhatKilos of rice, sugar and oil sold per store per day
Who collected itEach store's staff, in a notebook at closing time
HowCounted from the day's sacks opened; typed into a spreadsheet weekly
WhenJanuary and February 2024
WhyTo reorder stock, not for analysis
LicenceThe owner's own data, used with permission
Codebookkilos is to one decimal place; store is the store's short name
Known problemsDays are sometimes forgotten; one store weighs in grams

Every line warns of something. "To reorder stock" means nobody checked the figures carefully. "Counted from sacks opened" means a sack opened late on Monday is counted on Tuesday. "Typed in weekly" means typing mistakes.

A codebook (or data dictionary) says what each column means, its units, and its codes. For official data it's usually a separate file or page called metadata or technical notes. Read it: a column called price might be retail or wholesale, with or without VAT, in pesos or centavos.

Pick a real dataset from PSA OpenSTAT or the World Bank, and fill in a card for it in a notebook note.

Wrong way: a licence that says no

You find a website with exactly what you need: weekly rice prices for every province, for ten years. You download the table, build the report's main chart from it, and send it to the owner.

Then someone reads the bottom of the page: "For personal, non-commercial use only. Not to be redistributed." The report is commercial and it redistributes the numbers. The chart has to come out, and the analysis built on it with it, the day before the deadline.

Read the terms before you start, and write the licence on the data source card. If the terms say no, ask the owner for permission in writing, or find the same figures from an open source: here, the PSA publishes rice prices too.

Personal data is stricter still. A file with customers' names, phone numbers or addresses falls under the Data Privacy Act of 2012, whatever anyone says about it. Don't collect, keep or share personal data the analysis doesn't need.

Check what you learned

A dataset is under CC BY 4.0. Can you use it in a report you’re paid for?
Why does it matter that the Tindahan sales were recorded “to reorder stock”?

Sources

Every example on this page was run with Python 3.14, and its output and error messages are copied from it. These pages cover the same ground in more depth.

All sources for Simple Data Analysis