Skip to content
Python and Data Primer / Scientific Python

pandas

A price without an instrument and date cannot support a reliable return calculation. pandas stores those labels and aligns calculations by them. This lesson loads a small price table, calculates returns and checks missing or duplicated observations. It builds on NumPy and prepares for the timing checks in time-series data.
Learning objectives. By the end of this note you should be able to:
  • construct a DataFrame with a time index;
  • select rows and columns by label;
  • detect missing values;
  • compute a return column without losing alignment.

In this lesson

  1. A labelled table
  2. Compute while preserving labels
  3. Validate the table before modelling
  4. A missing price affects adjacent returns

Before you start

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or browse the Python and Data Primer syllabus.