In the previous lesson, we learned about NumPy broadcasting. In this lesson, we'll learn how to load data from a CSV into an ndarray. We'll also learn how to extract parts of an ndarray whose values satisfy a specific condition.

In particular, you'll:

  1. Learn how to load a CSV into an ndarray.
  2. Learn NumPy limitations for working with non-numerical data.
  3. Learn how to use comparison operators in NumPy.
  4. Learn how to use logical operators in NumPy.
  5. Learn how to use boolean masks to extract parts of the data that satisfy a specific condition.

As with all Dataquest lessons, this is an interactive learning experience. You'll be writing real Python code and using NumPy in our browser-based coding environment so there's no setup and no obstacles between you and learning!


  • Learn how to work with various datasets in NumPy.
  • Learn to use Boolean Indexing to select the data you want.

Lesson Outline

  1. Introduction
  2. Loading CSV Data
  3. Removing Invalid Data
  4. NumPy Limitations
  5. Comparing Column Values
  6. Comparing with a Single Value
  7. Logical Connectors
  8. Boolean Masks
  9. Boolean Masks in Higher Dimensions
  10. 1D Mask on 2D Array
  11. Next Steps