開始使用免費開始

使用索引進行存取

在這個練習中,你會使用 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

本練習屬於課程

Intermediate Python for Finance

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

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

# Cell last row, Symbol column
print(positions.____[____, ____])
編輯並執行程式碼