Skip to content

Home / Visual decks / Pandas, visually

Visual deck · 10 scenes · 20 animation beats

Pandas, visually

An animated tour of pandas: the anatomy of a DataFrame, Series, boolean masks, loc versus iloc, vectorisation, groupby, merge and rolling windows, on a small price table.

By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 3 October 2026 About this site

A DataFrame is a table with an index, and almost every pandas error comes from forgetting the index. This deck draws the table, then animates what each operation does to it: a boolean mask keeps some rows, loc selects by label, iloc by position, groupby splits the table into piles and merge lines two tables up by a key.

The data is a few days of prices for three tickers, small enough to check every number by eye. That is deliberate: once you can predict the output on five rows, the same code works on five million.

How to drive it

  • Click or tap anywhere, or press Space or the right arrow: one press is one animation beat, so you can narrate between reveals.
  • Left arrow or right click goes back one beat. Escape leaves the deck.
  • The position is kept in the address bar (#scene.beat), so a link lands on the exact beat you were showing.

The 10 scenes

  1. 1The anatomy of a DataFrame: index, columns, values
  2. 2A column is a Series, and a Series has an index too
  3. 3Boolean masks: a column of True and False that filters rows
  4. 4loc selects by label, iloc by position
  5. 5Vectorisation: one expression, every row, no loop
  6. 6groupby: split, apply, combine
  7. 7merge: lining up two tables by a key
  8. 8Rolling windows: a moving average, drawn as a sliding box
  9. 9The NaN that appears at the start of every rolling column
  10. 10The five lines you will write every day

Go further

Next deckSQL joins, visually