from iexfinance import Stock
import matplotlib.pyplot as plt
tsla = Stock('TSLA')
tsla.get_close()
tsla.get_price()
from iexfinance import get_historical_data
from datetime import datetime
import pandas as pd
pd.set_option('display.max_rows', 1000)
start = datetime(2017, 2, 9)
end = datetime(2017, 5, 24)
df = get_historical_data("TSLA", start=start, end=end, output_format='json')
df.plot()
plt.show()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-16-77b5455be846> in <module>()
8
9 df = get_historical_data("TSLA", start=start, end=end,
output_format='json')
---> 10 df.plot()
11 plt.show()
12 df
AttributeError: 'dict' object has no attribute 'plot'
I am trying to get the plot for the dataframe created with the different prices from the start and end date. I tried reading different blogs but none seem to solve it. I am sure I am making a very basic error. Although, I am not able to figure out what am I doing wrong here, any suggestions to fix it?
get_historical_datareturns dict. Try to do:df = pd.DataFrame(get_historical_data("TSLA", start=start, end=end, output_format='json')).df. What values it contains?