开始使用免费开始使用

使用索引进行访问

在本练习中,您将使用 DataFrame 中行和列的数字索引来选择并设置股票持仓。提供的 DataFrame 数据如下:

Symbol Purchased Quantity Price
0 AAPL 2016-01-08 23 96.96
1 AAPL 2018-09-07 50 221.30
2 AMZN 2020-02-14 14 324.95

本练习是课程的一部分

Python 金融进阶

查看课程

交互式实操练习

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

# Cell first row, Price column
print(positions.iloc[____, ____])

# Cell last row, Symbol column
print(positions.____[____, ____])
编辑并运行代码