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.
To use the code below to upgrade the pandas_datareader.
and the library will be upgraded and you can get the newest data.

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
Post a Comment