Session Ready
Exercise

Accessing using names

In this exercise, you will access data that tracks an account over time. This account consists of wealth from both cash and equities. The data is supplied in a DataFrame named ledger with the index set to dates, represented as strings. The data looks like this:

Cash Securities Balance
2020-10-01 0.0 -300.0 1222.0
2020-10-02 300.0 -200.0 1322.0
2020-10-03 -100.0 700.0 1922.0
Instructions 1/3
undefined XP
  • 1
    • Use column and row names to select the balance as of October 2nd.
    • Select the balance as of October 3rd using names.
    • 2
      • Select cash and securities for October 3rd.
      • Select the balances for October 1st and 3rd.
    • 3
      • Use slicing to select all columns for October 1st.
      • Use slicing to select the balance for all dates.