Accessing using indexes
In this exercise, you will select and set stock positions using the numerical indexes of the rows and columns in a DataFrame. The provided DataFrame has this data:
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 |
This exercise is part of the course
Intermediate Python for Finance
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Cell first row, Price column
print(positions.iloc[____, ____])
# Cell last row, Symbol column
print(positions.____[____, ____])