← All courses
IVYXSTUDIO · COURSE

PANDAS 101

pandas-101 · v1.0.0

ivyx

Tables you can question: read a real file, repair the column that arrived as text, decide what the holes mean, group and join without losing rows, and tell a count from a rate before one of them costs you the answer.

intermediate380 min10 lessonsen
#pandas#dataframe#groupby#data-cleaning#data-science#ai-series#intermediate

What this course is for

By the end of this course you can load a real table, clean what is wrong with it, and answer questions about groups without writing a single loop, with an answer that says what it covers and what it leaves out.

What you will be able to do

  • Read a CSV and interrogate it with shape, info, head and describe before trusting a single number
  • Select rows by label, by position and by condition, and know which of the three you are doing
  • Repair a numeric column that arrived as text, and count what the repair cost
  • Choose between dropping, filling and keeping missing values, with a reason you can say out loud
  • Group a table, aggregate it, and check that the groups add up to the table
  • Tell a count from a rate, and catch a ranking that is right for a reason that will not survive new data
  • Join two tables without losing rows to a default nobody chose

Who it is for

Learners who finished NUMPY 101 and want labelled tables rather than bare arrays, and anyone whose pandas is copied from search results and works most of the time

Before you start

  • NUMPY 101, or comfort with arrays, dtypes and vectorized thinking
  • PYTHON 101-level Python

Lesson path

The DataFrame2 lessons

Columns that share one index, and a file that becomes a table

  1. 1Series and DataFrame30 min

    Say what a column is, what an index is, and which one you are holding

  2. 2Loading data35 min

    Read a CSV and interrogate it with head, info and describe

Selecting2 lessons

Rows by name, by position, and by description

  1. 3loc and iloc35 min

    Select by label and by position, and predict the off by one between them

  2. 4Filtering rows35 min

    Combine conditions with and, or and not, brackets and all

Cleaning2 lessons

The holes and the wrong types, and the decisions behind both

  1. 5Missing values40 min

    Predict what NaN does to a mean, then decide, drop, fill or keep

  2. 6Types and text columns35 min

    Fix a numeric column that arrived as text, using .str and a converter

Groups2 lessons

Split, apply, combine, and the two statistics that both look like answers

  1. 7groupby40 min

    Split, aggregate and read the result's index

  2. 8Counts versus rates45 min

    Catch the group ranking that a count gets right by coincidence and a rate gets right for the reason

Combining2 lessons

Two tables, one key, and one question answered end to end

  1. 9merge40 min

    Predict the row count of an inner versus a left join before running it

  2. 10One real question45 min

    Answer a question that needs two tables, a clean up and a groupby

About this course

PANDAS 101: Tables you can question

Ten lessons that turn a file you have never seen into an answer somebody can act on. One dataset runs through all of them: 24 used car listings with the dirt a real export has in it, a price column that arrived as text, two missing odometer readings, and a brand that the lookup table has never heard of.

Every lesson ends where a real analysis ends, with a number and a sentence saying what the number covers.

How this course teaches

Same tutor as the rest of the series: predict before you run, and a hint ladder that ends in an explanation rather than in pasted code. What changes here is that no cell passes by being run. A blank raises until you fill it, a broken cell raises until you fix it, and every challenge checks its own work, so the notebook cannot be finished by pressing Run down the page.

pandas has a particular danger, and this course is built out of it: code that runs cleanly and answers a different question from the one you asked. A filter that compares prices alphabetically and returns real rows. A dropna() that removes six listings because of a column nobody asked about. An inner join that loses a third of the lot and raises the average price while it goes. A ranking by count that names the right brand for a reason that will not survive next week's stock. Those are the diagnose cells, and each one prints something plausible before a cross check refuses it.

What you will be able to do

  • Read a CSV and interrogate it before trusting a single number
  • Select rows by label, by position and by condition, and know which you used
  • Repair a numeric column that arrived as text, and count what the repair cost
  • Choose between dropping, filling and keeping missing values, out loud
  • Group, aggregate, and check that the groups add up to the table
  • Tell a count from a rate, and say which question each one answers
  • Join two tables without losing rows to a default nobody chose
  • Shape an answer: one row per thing compared, named statistics, and coverage

The lessons

The DataFrame

  1. Series and DataFrame
  2. Loading data

Selecting 3. loc and iloc 4. Filtering rows

Cleaning 5. Missing values 6. Types and text columns

Groups 7. groupby 8. Counts versus rates

Combining 9. merge 10. One real question

Where this course sits

Fourth course of the ivyx AI series, directly after numpy-101, whose vectorized thinking is assumed rather than repeated: a column here is an array with labels, and lesson 3 is numpy-101's "square data hides the bug" warning one abstraction up. Lesson 8 is the course's anchor and the series' oldest lesson, rebuilt: a count and a rate that rank the same group first, on data where the agreement proves nothing.

dataviz-101 draws these tables, and ml-101 models them. Both inherit this course's habit: a number that looks right is not evidence, and the check is a second route, a total that has to add up, or a perturbation the answer has to survive.