All lessons

Module 1: Getting started · Lesson 1.6 · about 15 min

A first look: head, info, describe

The five commands to run on every new table: head and sample to see rows, info for types and missing values, describe for numbers, value_counts for categories, and nunique for keys.

Key points, meanings and formulas on one page: choose "Save as PDF" in the print box.

Module 1 · about 15 minutes · uses Lesson 1.5. You’ll have a routine for the first five minutes with any new dataset.

Before any analysis, spend two minutes looking: a few rows, the types and gaps, the ranges, and the most common values.

In everyday terms: a mechanic walks round a car before opening the bonnet: tyres, lights, dents. info, describe and value_counts are that walk round, and they catch most problems early.

1. See some rows

Pythonorders.csv

display() shows a table mid-box; the last line is shown anyway.

2. Types and missing values: info

Pythonorders.csv

Check: is each column the type you expect (dates as datetime64, amounts as numbers)? Does any column have fewer non-null values than there are rows?

3. Numbers: describe

Pythonorders.csv

Read the min and max for impossible values, and compare mean with median (50 %) for skew (Statistics Lesson 1.2).

4. Categories and keys

Pythonorders.csv

There are more rows than distinct order ids, so a row is an order line (one product within an order), not an order. Knowing what one row means (the grain) prevents double counting later.

head(), sample()
See real rows.
info()
Column types and non-missing counts.
describe()
Count, mean, SD, min, quartiles, max for numbers.
nunique(), value_counts()
How many distinct values, and which are most common.
Physical meaning
Each summary answers a "could this be wrong?" question: a negative quantity, a price of 9,999, a store that appears once, a date in 1970. Spotting them now saves wrong conclusions later.

“describe() covers everything.” It skips text columns by default and says nothing about duplicates or keys. Add describe(include=‘object’), duplicated().sum() and value_counts() on the key columns.

Watch it happen, one step at a time:

Rows. orders.head(): the columns look as expected.
Types and gaps. orders.info(): 9,717 rows, qty int64, date datetime, no missing values.
Ranges. orders.describe(): qty from 1 to a small maximum, discount from 0 to 0.3. Nothing impossible.
Keys. orders['store_id'].value_counts(): 7 stores, none tiny.
Note it. Write one line: "9,717 lines, Jan 2025 to Jun 2026, 7 stores, no gaps." That line opens your report.

5. Your turn

Your turncustomers.csv
Your turncustomers.csv
How it works: the first-look checklist
  1. df.shape: as many rows and columns as you expected?
  2. df.head(), df.sample(5): what does one row mean (the grain)?
  3. df.info(): right types? missing values?
  4. df.describe(): impossible or extreme numbers?
  5. df[col].value_counts() and df.nunique(): odd categories, spelling variants, unique keys?

Write down what surprises you; each surprise is a question for the data owner or a cleaning step (Module 3).

6. Practice

  1. Suppose info() said discount had 9,000 non-null values out of 9,717 rows. What does that tell you?
  2. Why use sample() as well as head()?
  3. What is the grain of orders.csv?
Answers
  1. 717 rows have no discount recorded: missing values to understand (zero discount? not recorded?).
  2. The first rows are often unusual (sorted by date, test rows). A random sample is more typical.
  3. One order line: one product in one order (an order can have several rows).

Try it on your own data: CSV profiler runs this whole checklist on a CSV in one go.

New words: head, tail, sample, info, describe, value_counts, nunique, grain.

  • head/sample for rows; info for types and gaps; describe for ranges.
  • value_counts and nunique for categories and keys.
  • Look for impossible values, odd types, rare categories and duplicates.
  • Write down what you found before analysing.

Check yourself

1Which command shows the number of non-missing values and the type of every column?
2describe() shows a qty column with min -3. What should you do?
3How do you check whether order_id is unique per row?

Sources

Your ticks stay in this browser. Save them as a file on the course home.

Updated 2026-11-22. All datasets are made up. Python runs in your browser (the first run downloads it once, about 20 MB); nothing you type is sent anywhere.