Exercise

Creating DataFrames

A security position is a record of ownership that includes the purchase price and date. This information is necessary if you want to calculate how much profit was made on a stock. You can have multiple positions of the same stock, if you purchase it multiple times. Use these positions of Apple stock to create DataFrames in this exercise:

Sym Price Date
APPL 105.00 2015/12/31
APPL 117.05 2017/12/01
APPL 289.80 2019/12/27

Instructions 1/3

undefined XP
  • 1
    • Create a dictionary with the exact column names holding the Apple data.
    • Create a DataFrame using the dictionary.
  • 2
    • Create a list of dictionaries with the position data.
    • Create a DataFrame using the list.
  • 3
    • Create a list of lists representing the positions data.
    • Define the column names.
    • Create a DataFrame from the data.