Exercise

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

Instructions 1/4

undefined XP
  • 1
    • Select the oldest price.
    • Select the newest symbol.
  • 2
    • Use slicing to select the oldest two purchase dates.
    • Use slicing to select the most recent purchase and quantity values.
  • 3
    • Set the quantity of the 2020 purchase to 15.
  • 4
    • Set all of the quantity values to zero.