In this lesson: Read a data table correctly and name the type of every column in it.
Almost all data you will meet is a table. If you have ever seen a class register or a receipt book, you already know the shape.
student_id | name | age | district | term_mark | passed
-----------+-----------+-----+----------+-----------+-------
1 | Aline | 17 | Gasabo | 78 | yes
2 | Jean | 18 | Huye | 41 | no
3 | Uwase | 17 | Gasabo | 65 | yes
The vocabulary
- A row (also called a record or observation) is one thing you measured — here, one student.
- A column (also called a variable, field or feature) is one thing you measured about every row — here, age or district.
- A cell is one value: the age of student 2.
The four types of data
Which calculations are allowed depends entirely on the type of the column. Get this wrong and you will compute nonsense.
- Nominal — names with no order. District, gender, phone brand. You can count them. You cannot average them: "the average district" is meaningless.
- Ordinal — ordered labels with unequal gaps. Satisfaction (poor / fair / good), education level. You can sort and take a median. Averaging is questionable.
- Interval / ratio (numeric) — real numbers you can add and average. Age, mark, price, rainfall in mm.
- Datetime — a moment in time. Looks like text, behaves like a number, and causes more bugs than every other type combined.
The trap: numbers that are not numbers
A column can hold digits and still be nominal:
student_id : 1, 2, 3 -> a name, not a quantity. Average = nonsense.
phone : 0788123456 -> a name. Also loses its leading 0 if stored as a number.
year : 2026 -> ordinal-ish. 2026 + 2025 means nothing.
term_mark : 78 -> a real number. Average = meaningful.
Ask yourself: does adding two of these values produce something real? If not, it is a label that happens to be written with digits.
Wide and long
The same facts can be laid out two ways. Wide puts each period in its own column:
name | term1 | term2 | term3
Aline | 78 | 81 | 74
Long (also called tidy) puts each measurement on its own row:
name | term | mark
Aline | term1 | 78
Aline | term2 | 81
Aline | term3 | 74
People read wide more easily. Tools compute on long more easily. You will convert between them constantly, and there is a one-line command for it in the pandas track.
Try it yourself
Find any real table — a receipt, a class list, a football league table. Write out its column names and label each one nominal, ordinal, numeric or datetime. Then find one cell that breaks the "one cell, one value" rule. There is almost always one.