Data and Variables
Rows and columns.
Most data comes as a table. Each row is one thing you measured, like one person, one sale, or one day. Each column is one thing you measured about it, like age, price, or temperature. Statisticians call the columns variables.

- Data is usually a table
- Rows are things
- Columns are variables
A tiny dataset
Here are five students. Each row is a student. The columns are their name, hours studied, exam score, and whether they passed. In machine learning, the columns we use to predict are called features. The one we want to predict, like passed, is called the target, or the label.
| name | hours | score | passed |
|---|---|---|---|
| Ana | 2 | 55 | no |
| Ben | 5 | 72 | yes |
| Cara | 8 | 90 | yes |
| Dev | 1 | 40 | no |
| Eli | 6 | 81 | yes |
A table in Python
In Python, a simple way to hold a column is a list. Here, hours and scores are two lists, where the same position is the same student. Len counts the rows. And zip walks through two columns together, row by row. Run it.
hours = [2, 5, 8, 1, 6]
scores = [55, 72, 90, 40, 81]
print("students:", len(scores))
for h, s in zip(hours, scores):
print(h, "hours ->", s, "points")students: 5 2 hours -> 55 points 5 hours -> 72 points 8 hours -> 90 points 1 hours -> 40 points 6 hours -> 81 points
Summary
Rows are the things we measure, and columns are variables. Features predict, and the target is what we want to predict. Next, the different types of data.
Key takeaways- Rows and columns
- Features and target
- Lists hold columns