pandas

Predict the table, then run it

Filtering, grouping, joining and reshaping all change the size of a table, and being good at this is being able to say what size before you look. Seven runs of drills and builds, ending with the question none of the tutorials ask: when you assign into a frame, does the write actually land?

Modules
7
Drills
10
Build steps
7
Time
~4h

Walk out able to

Predict a merge’s row count from its keys, move a table between long and wide, and say whether a write reaches the frame — before running any of it.

What you work through

01

Frames, dtypes, selection

What a column really holds, and reaching one exact row.

02

Grouping and joining

One row per group — and the merge that doubled your rows.

03

Long, wide and back

Melt, pivot and stack, as arithmetic rather than magic.

04

Where a write lands

The warning, what replaced it, and the report you build.

What you get

Skills that stick

Every project mixes short lessons, focused drills and real build steps, so you finish with working code and the judgement behind it.

You will practise

  • Selecting by label, position and mask
  • Grouping, aggregating, and missing keys
  • Merge row counts and column names
  • Long and wide, and where a write lands

Afterwards you can

  • Call a merge’s row count before running it
  • Move a table between long and wide
  • Spot chained assignment on sight
  • Read pandas 2.x code on pandas 3.x

Modules

Step by step

Each module builds on the last. Read a short lesson, drill it until it's second nature, then put it to work.

  1. 1

    Get a frame and see what is in it

    ~22 min

    Build a frame, read its dtypes, and say how many values are really there.

    • LessonWhy a frame and not a list of dicts4 min
    • Build stepBuild your first frame and read it7 min
    • DrillSay what dtype a column will get11 min
  2. 2

    Select the rows you meant

    ~42 min

    Reach any subset by label, by position or by mask — and know the count first.

    • LessonTell loc and iloc apart for good11 min
    • Build stepFilter sixty rows with a mask8 min
    • DrillCount the rows a filter keeps12 min
    • DrillTell a label from a position11 min
  3. 3

    One row per group

    ~40 min

    Split by a key and predict both the value and the shape of what comes back.

    • LessonCollapse a frame to one row per town10 min
    • Build stepTotal fifty readings by town6 min
    • DrillCount the rows a grouping returns12 min
    • DrillAggregate a column with gaps in it12 min
  4. 4

    Line two frames up on a key

    ~41 min

    Predict a merge’s row count from the keys, and catch the multiplication early.

    • LessonDecide which rows a merge keeps11 min
    • Build stepPredict an outer join, then run it6 min
    • DrillCount the rows a merge returns13 min
    • DrillName the columns a merge produces11 min
  5. 5

    Long and wide are one table

    ~28 min

    Move a table between the two encodings and say what shape it lands in.

    • LessonTurn a long table wide, and back10 min
    • Build stepPivot forty-five readings into a grid6 min
    • DrillPredict the shape after a reshape12 min
  6. 6

    The copy you thought was a view

    ~33 min

    Say whether a write reaches the frame — on your pandas, and on the one before it.

    • LessonSpot chained assignment on sight10 min
    • LessonRead pandas 2.x code on pandas 3.x10 min
    • DrillSay where a write lands, on sight13 min
  7. 7

    Build the report

    ~42 min

    Recall the calls from memory, then turn two tables into one wide report.

    • DrillWrite the call that does what you meant12 min
    • Build stepThrow away the visits with no town10 min
    • Build stepTotal the minutes by town and year8 min
    • LessonTurn the totals into a wide report12 min

Ready when you are.

Work through it at your own pace and pick up right where you left off.