← all tracks

pandas

Labelled data: indexes, filtering, and split-apply-combine.

28 of 28 lessons built·0 of 109 exercises solved
Module 1

Foundations

4/4

The two containers, the index that glues them, and getting data in.

  1. 1

    What a DataFrame actually is

    Index, columns, values, dtypes — the four parts every later method moves around.

  2. 2

    The index, and alignment

    Labels take part in the arithmetic — the one idea NumPy doesn’t have.

  3. 3

    dtypes in pandas

    One type per column — plus the nullable and categorical ones pandas had to add.

  4. 4

    Getting data in

    read_csv, and the four calls to run before you trust a single row.

Module 2

Selection

4/4

Getting at rows and columns — by label, by position, by condition.

  1. 5

    [] vs .loc vs .iloc

    Three ways in, three different questions — and the one that silently returns the wrong row.

  2. 6

    Filtering rows with a boolean mask

    Why df[df["cups"] > 100] works, and why the index comes out full of holes.

  3. 7

    query, isin and between

    The readable ways to say a filter, once masks stop scaling.

  4. 8

    Adding and changing columns

    Creating columns, and the chained assignment that silently does nothing.

Module 3

Cleaning

4/4

Missing values, duplicates, messy text and inconsistent types.

  1. 9

    Missing data

    Dropping and filling are different claims — and they give different answers.

  2. 10

    Duplicates

    “Duplicate” is a decision you make, and subset= is where you make it.

  3. 11

    Text with .str

    One capital letter, one wrong number, no error message.

  4. 12

    Renaming, sorting and dropping

    Housekeeping — and the two footguns hiding in it.

Module 4

Aggregation

4/4

Summarising, grouping, and reshaping into a summary table.

  1. 13

    Summarising a table

    describe() is a checklist, not a report — run it on everything.

  2. 14

    GroupBy: split, apply, combine

    The three motions hiding inside every .groupby() call.

  3. 15

    agg, transform and apply

    Told apart by one thing: the shape of what comes back.

  4. 16

    pivot_table and crosstab

    The same aggregation, with the second key across the top instead of down the side.

Module 5

Combining & reshaping

4/4

Stacking tables, joining them, and switching between wide and long.

  1. 17

    Stacking tables with concat

    No keys, no matching — and two traps that come free with alignment.

  2. 18

    merge and join

    The named side is kept in full — and duplicate keys multiply your rows.

  3. 19

    Wide and long form

    Compute in long form, present in wide. Most awkward pandas is a shape problem.

  4. 20

    MultiIndex, stack and unstack

    An index whose labels are tuples — and two methods for moving levels sideways.

Module 6

Time series

3/3

Dates as a first-class index — resampling, rolling windows, shifts.

  1. 21

    Dates and times

    A date read from a file is a string, and strings sort in the wrong order.

  2. 22

    resample and rolling

    One changes how many points there are. The other changes what each one says.

  3. 23

    shift, diff and change over time

    Slide the column down a row, and every “compared to last time” question falls out.

Module 7

In practice

2/2

Categories, memory, and writing pandas that reads well.

  1. 24

    Categories and memory

    Store each value once — and get meaningful sorting for free.

  2. 25

    Method chaining

    One expression, no half-modified frames, and the same answer every time you run it.

Module 8

Capstones

3/3

Whole projects, end to end.

  1. 26

    Capstone: clean a messy dataset

    capstone

    Thirteen rows, four defects, one pipeline.

  2. 27

    Capstone: an analysis, end to end

    capstone

    From a messy table to a ranked report — and the two joins that could ruin it.

  3. 28

    Capstone: a time series report

    capstone

    Is trade growing, and what does a normal week look like?