Pandas

20 min read

Pandas is the Python library for tables of data. Think of an Excel sheet that you control with code. It is the everyday tool for looking at model test results, chat logs and training data. In this lesson you will load a small table of model test results. You will filter it, sort it, add a column, group it, and fix missing values.

New words

DataFrame
A table with named columns and numbered rows, like a class register.
Series
One column of a DataFrame.
Index
The row labels on the far left of the table.
CSV
A plain text file where each row is a line of values.
Filtering
Keeping only the rows that pass a test.
groupby
Splitting rows into piles and calculating one answer for each pile.
NaN
The mark pandas uses for a blank or missing number.

What you will learn

  1. Why pandas matters for AI work
  2. Creating a DataFrame
  3. Taking a first look
  4. Selecting columns and rows
  5. Sorting and adding a column
  6. Grouping: one answer per model
  7. Missing values and counting
  8. Try it: transform the table
  9. Common mistakes
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap