开始使用免费开始使用

筛选数组

在本节中,您将聚焦于两个行业:

  • Information Technology
  • Consumer Staples

numpy 已按 np 导入,且 S&P 100 数据以数组形式存储在 namessectorspe(市盈率,price to earnings ratio)中。

本练习是课程的一部分

Python 金融入门

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Create boolean array 
boolean_array = (____ 'Information Technology')

# Subset sector-specific data
it_names = ____
it_pe = ____

# Display sector names
print(it_names)
print(it_pe)
编辑并运行代码