text_plain_output_1.png
from pandas_datareader import data

ibm = data.DataReader('IBM', 'yahoo', start='1/1/2000')

time_elapsed = (ibm.index[-1] - ibm.index[0]).days

price_ratio = ibm['Adj Close'][-1] / ibm['Adj Close'][1]
inverse_number_of_years = 365.0 / time_elapsed
cagr = price_ratio ** inverse_number_of_years - 1
print(cagr)