Lesson 4.1

DataFrames and Series

A DataFrame is a table of Series, each with its own dtype.

31mBeginner16.9k students

Overview

Look at the data before you trust it

A DataFrame is a table of Series, each with its own dtype. The first thing to do after loading is inspect the dtypes and the null counts, because a numeric column read as text will silently produce nonsense averages later.

Label-based and position-based selection are separate accessors on purpose. Mixing them is the source of most confusing indexing errors, especially after a filter has left a non-contiguous index.

Parse dates at load time rather than converting afterwards. It is one argument and it saves an entire category of comparison bugs.

In this lesson you will:

  • Load a dataset and inspect its shape
  • Select rows and columns predictably
  • Fix dtypes before analysing

Resources

Previous Lesson
Next Lesson
DataFrames and Series — Python Foundations for Data Work — Vertex