1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Python for Finance

Exercise

Filtering arrays

In this lesson, you will focus on two sectors:

  • Information Technology
  • Consumer Staples

numpy is imported as np and S&P 100 data is stored as arrays: names, sectors, and pe (price to earnings ratio).

Instructions 1/2

undefined XP
    1
    2
  • Create a boolean array to determine which elements in sectors are 'Information Technology'.
  • Use the boolean array to subset names and pe in the Information Technology sector.