1. Learn
  2. /
  3. คอร์ส
  4. /
  5. Introduction to Python for Finance

Connected

แบบฝึกหัด

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).

คำแนะนำ 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.