I was trying to read the data from Yahoo Finance but I am getting an error.
Here's my code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas_datareader as data
Here's the cell where I am getting the error:
start = '2012-01-01'
end = '2021-12-31'
df = data.DataReader('AAPL', start, end)
This is the error message I am encountering:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-12-d022432a6feb> in <module>()
2 end = '2021-12-31'
3
----> 4 df = data.DataReader('AAPL', start, end)
1 frames
/usr/local/lib/python3.7/dist-packages/pandas_datareader/data.py in DataReader(name, data_source, start, end, retry_count, pause, session, api_key)
371 if data_source not in expected_source:
372 msg = "data_source=%r is not implemented" % data_source
--> 373 raise NotImplementedError(msg)
374
375 if data_source == "yahoo":
NotImplementedError: data_source='2012-01-01' is not implemented
Any help will be appreciated. Thank you :)
df = data.DataReader('AAPL', 'yahoo', start = '2012-01-01', end = '2021-12-31')
Output
High Low ... Volume Adj Close
Date ...
2012-01-03 14.732143 14.607143 ... 302220800.0 12.575914
2012-01-04 14.810000 14.617143 ... 260022000.0 12.643499
2012-01-05 14.948214 14.738214 ... 271269600.0 12.783866
2012-01-06 15.098214 14.972143 ... 318292800.0 12.917505
2012-01-09 15.276786 15.048214 ... 394024400.0 12.897019
No data source specified: 'yahoo'