Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Data Science & Statistics with Python — Alpha School

Lesson 8: Working with Real-World Datasets

So far you have worked with small, clean examples. Real datasets are bigger, messier and more interesting — and they are free to explore. Public sources include government statistics offices, which publish data on health, education and the economy; the World Bank, which publishes country-level indicators; and open data portals run by cities and universities. The Palmer Penguins dataset, a small table of measurements of three penguin species, is a favourite teaching dataset because it is clean, real, and just big enough to be interesting.

Working with a real dataset starts with the same exploration as ever, but with more suspicion. Read the documentation first: what does each column mean, what are the units, when was the data collected, and who is missing? A column called "income" might be weekly or yearly, before or after tax, and the answer changes everything. A dataset of hospital patients might exclude everyone who was never admitted, so it cannot tell you about the general population. The documentation is part of the data; ignore it and you will analyse something you do not understand.

A Small Real Analysis

Imagine a worked example with the penguins data: 344 penguins of three species, with body measurements including flipper length and body mass. The question is simple — do the species differ in size? Loading the data with pandas, grouping by species and summarising flipper length shows one species clearly larger than the others, and a scatter plot of flipper length against body mass shows three loose clusters, one per species. That is a complete small analysis: a question, a dataset, a grouping, a chart, and an answer — and it took a handful of lines of code.

The same pattern scales up. The questions get harder and the cleaning gets longer, but the shape of the work is the same: understand the data, ask a specific question, explore, analyse, communicate. The analysts who struggle with real data are rarely the ones who cannot do the mathematics; they are the ones who skip the documentation and the exploration.

Choosing Your Own Dataset

For the capstone at the end of this course you will need a dataset of your own. Choose one that interests you and that you can understand: a topic you care about will keep you going through the cleaning. Check that it has enough rows to analyse — a few hundred at least — and that its documentation tells you what the columns mean. Avoid datasets about people unless you understand the privacy issues in Lesson 17. And check the licence: public datasets are usually free to use, but the source should still be credited in your write-up.

Reading Documentation Like a Detective

Dataset documentation is often dull, incomplete, or missing entirely, and that is itself information. When a column has no description, treat it with suspicion until you can work out what it means from its values. When the documentation says the data covers 2020 to 2024 but the file contains rows from 2019, ask which is right. When a codebook lists values that never appear, or values appear that are not listed, something changed between the documentation and the data. The detective work feels slow, but it is the difference between analysing the data you think you have and the data you actually have.

A practical habit is to write a short data diary as you explore: one paragraph per dataset, saying where it came from, what each important column means, what is missing, and what you still do not understand. The diary becomes the methods section of your report, and it is also the document you will be grateful for when you return to the project weeks later. Data science is often described as working with data; in practice, much of it is working with the documentation about the data.

Watch & Learn

One video to watch for this unit, from a trusted educator.

Key Terms

Open data
Data published freely for anyone to use, often by governments and researchers.
Documentation
The notes describing a dataset: what each column means, the units, and how it was collected.
Palmer Penguins
A teaching dataset of body measurements of three penguin species.
World Bank
An organisation publishing country-level data on economies, health and education.
Licence
The terms under which a dataset may be used, including whether credit is required.
Metadata
Data about data: the documentation, units and collection details of a dataset.

Discussion Questions

  1. A dataset's column is called 'income' with no units. What could go wrong if you assume it is yearly income?
  2. Why is a hospital dataset a bad source for learning about the general population?
  3. What makes a dataset a good choice for a capstone project — and what makes a bad one?

Practice Questions

  1. Name two public sources of real datasets.
  2. Why read a dataset's documentation before analysing it?
  3. In the penguins example, what did grouping by species show?
  4. What does a scatter plot of flipper length against body mass show in that example?
  5. What should you check before choosing a dataset for your capstone?
Show answers
  1. Any two of: government statistics offices, the World Bank, city or university open-data portals, or teaching datasets such as Palmer Penguins.
  2. Because it tells you what each column means, the units, when the data was collected, and who is missing — without it you may analyse something you do not understand.
  3. That the species differ in size — one species is clearly larger than the others in flipper length.
  4. Three loose clusters, one per species. The species separate visibly in the plot.
  5. That it interests you, has enough rows, has documentation explaining the columns, and has a licence that allows your use — and that privacy is considered if it is about people.
Keep reading to complete this lesson