All lessons

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

Series: one column of data

A Series is one column with an index: make one, do maths on the whole column at once, use summary methods like sum, mean and value_counts, and see how missing values behave.

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

Module 1 · about 15 minutes · uses Lesson 1.2. You’ll be able to create a Series, do column maths, and summarise it.

A Series is one column of values with a label on every row, and maths on it happens to the whole column at once.

In everyday terms: a column in a spreadsheet where the row numbers can be names (store IDs, dates). Typing ”× 2” once doubles every cell, with no formula to drag down.

1. A labelled column

A Series is one column of values plus an index of labels. Each column of a DataFrame is a Series.

Python

The left column is the index (labels), the right the values. Below, pandas notes the dtype: int64 means whole numbers.

2. Whole-column maths

Operations apply to every value at once. No loops.

Python

The last line is filtering: a True/False Series inside the brackets keeps the True rows. You’ll use it constantly (Lesson 2.3).

3. Summaries

Python

None became NaN (“not a number”), pandas’ mark for missing, and the whole Series turned into decimals (float64), because NaN is a float. Summaries skip NaN: the mean is over 4 days, not 5.

For text, value_counts() counts each value:

Python
values
The data, all of one type.
index
The labels of the rows (0, 1, 2... by default).
s * 2, s + t
Whole-column maths; two Series line up by index label, not by position.
Physical meaning
The index is how pandas knows which value belongs to which thing. Adding two Series matches labels like matching name tags, so a value never lands on the wrong store even if the order differs.

“Adding two columns adds them row by row in order.” pandas adds them by index label. If one Series has S01, S02 and the other S02, S03, you get NaN for S01 and S03. Check the labels when results look half empty.

Watch it happen, one step at a time:

A Series.
indexvalue
S01120
S0295
WEB140
Whole-column maths. s * 1.1 multiplies every value: 132, 104.5, 154.
Summary. s.sum() → 355; s.mean() → 118.33.
Line up by label. Add a Series with S02 and WEB only: S01 becomes NaN because it has no partner.
indexs + t
S01NaN
S02100
WEB150

4. Your turn

Your turn
Your turn
How it works

Principle: a Series is a NumPy array of one type plus an index. Maths runs on the whole array in compiled code (vectorised), which is why s * 2 on a million values takes milliseconds.

Alignment: when you combine two Series, pandas matches labels, not positions. Index labels missing on one side give NaN:

Python

5. Practice

  1. What dtype is pd.Series([1, 2, None]), and why?
  2. How do you count the missing values in s?
  3. s = pd.Series([5, 10, 15]). What does s[s >= 10].sum() give?
Answers
  1. float64: missing values are NaN, which is a float, so the whole column becomes floats.
  2. s.isna().sum() (True counts as 1).

New words: Series, index, dtype, vectorised, NaN, boolean mask, alignment.

  • A Series = values + index labels.
  • Arithmetic applies to every value at once.
  • Two Series combine by matching labels, not positions.
  • sum, mean, min, max, count and describe summarise a Series.

Check yourself

1What does s * 2 do to a Series s?
2What does s.mean() do with missing values (NaN)?
3What is the index of a Series?

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.