Solve the problem of Google Colab's DataReader Error to get financial data for free

If you use the code below to get the financial data from yahoo.
The Google Colaboratory will incur an error,
because the pandas_datareader is old version in Colaboratory.




from pandas_datareader import data
import pandas as pd
import matplotlib.pyplot as plt
import datetime as dt
import numpy as np
start = dt.date(2010,1,1)
end = dt.date(2020,12,31)
aapl = data.DataReader('GOOGL',"yahoo",start,end)
aapl.head()




To use the code below to upgrade the pandas_datareader.


!pip install --upgrade pandas-datareader
from pandas_datareader import data
import pandas as pd
import matplotlib.pyplot as plt
import datetime as dt
import numpy as np

start = dt.date(2010,1,1)
end = dt.date(2020,12,31)

aapl = data.DataReader('GOOGL',"yahoo",start,end)
aapl.head()




and the library will be upgraded and you can get the newest data.



Comments

Popular posts from this blog

AWS Notes - Network - TransferFamily(Transfer) connect with EFS

Build JupyterNotebook(Anaconda) environment in AWS EC2

AWS Notes - DevOps - OpsWorks