Here is the table specified as df:
| id | ticker | date |
|---|---|---|
| 1 | PLTR | 2022-01-07 |
| 2 | GME | 2022-01-06 |
| 3 | AMC | 2022-01-06 |
| 4 | GOOD | 2022-01-07 |
| 5 | GRAB | 2022-01-07 |
| 6 | ALL | 2022-01-06 |
| 7 | FOR | 2022-01-06 |
I want to have something like this:
| id | ticker | date | Price |
|---|---|---|---|
| 1 | PLTR | 2022-01-07 | $16.56 |
| 2 | GME | 2022-01-06 | $131.03 |
| 3 | AMC | 2022-01-06 | $22.46 |
| 4 | GOOD | 2022-01-07 | $24.76 |
| 5 | GRAB | 2022-01-07 | $6.81 |
| 6 | ALL | 2022-01-06 | $122.40 |
| 7 | FOR | 2022-01-06 | $21.26 |
I tried df['Price'] = yf.download(df['ticker'],df['date'])['Close'] using the yahoo finance tool but received an error: AttributeError: 'Series' object has no attribute 'split'
I also tried the pandas_datareader (imported as web), got the same error: df.assign(Price=web.DataReader(list(df.ticker('\n')), 'yahoo', list(df.date)))['Close']
Any advice/ideas what I am doing wrong?