Resolved: NotImplementedError
Hi, I'm getting this error when I try to execute the line before the last one (when we assing the data to the variable PG):
NotImplementedError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_5556\1473850925.py in <module>
----> 1 PG = wb.DataReader('PG', data_source='Yahoo', start='1995-1-1')
~\anaconda3\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
205 f"Can only specify {repr(old_arg_name)} "
206 f"or {repr(new_arg_name)}, not both."
--> 207 )
208 raise TypeError(msg)
209 kwargs[new_arg_name] = new_arg_value
~\anaconda3\lib\site-packages\pandas_datareader\data.py in DataReader(name, data_source, start, end, retry_count, pause, session, api_key)
365 if data_source not in expected_source:
366 msg = "data_source=%r is not implemented" % data_source
--> 367 raise NotImplementedError(msg)
368
369 if data_source == "yahoo":
NotImplementedError: data_source='Yahoo' is not implemented
PD: My code is exactly the same as the one in the video. I also updated the pandas in the Anaconda's prompt, but didn't work. I also ty another code (import yfinance as yfin
yfin.pdr_override()) and that also didn't work, with that alternative code I got: ModuleNotFoundError: No module named 'yfinance'
Please help me.
Found following solution:
import pandas
from pandas_datareader import data as pdr
import yfinance as yfin
yfin.pdr_override()
df = pdr.get_data_yahoo("PG", start="1995-1-1", end="2023-1-1")
print(df)
Credit : Alok
Hi Mayurkumar,
With that, I got the following error:
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_5436\199051433.py in <module>
----> 1 import yfinance as yfin
ModuleNotFoundError: No module named 'yfinance'
use 'yahoo' instead of 'Yahoo'
ModuleNotFoundError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from pandas_datareader import web as wb
ModuleNotFoundError: No module named 'pandas_datareader'
Thanks for reaching out.
Currently, the pandas-datareader package isn't working as shown in the videos. Therefore, as mentioned in the following note in the course, please use the alternative, which is the *.csv files attached to the lectures.
An update of the supporting materials is currently being prepared to further improve your experience.
Otherwise, if you insist on working with up-to-date information, currently the yfinance module is working. It functions similarly to the pandas-datareader package shown in the video. But the code structure to use to download data is the following:
import yfinance as yf
data = yf.download("AAPL", start="2020-01-01", end="2023-01-01")
orimport yfinance as yf
ticker = yf.Ticker("AAPL")
data = ticker.history(period="1y")
print(data.head())
Hope this helps.Kind regards,
Martin