I am trying to display a time series chart in bokeh but the error message I get reads "cannot import name 'TimeSeries ". I am very new to bokeh, and python, so any and all help will be greatly appreciated.
from yahoo_finance import Share
import pandas as pd
from bokeh.charts import TimeSeries, output_file, show
# Getting stocks from Yahoo Finance
yahoo = Share('YHOO')
google = Share('GOOGL')
# User selects stocks
stock = input("Enter stock name: ")
choice = Share(stock)
yahoo.refresh()
choice.refresh()
# gets stock data for a desired Stock
yahooData = choice.get_historical('2016-05-01', '2016-05-23')
# all dates are stored here
date = []
# all stock prices are stored here
data = []
# sanity check to see if the thing works
for i in range(10):
date.append(yahooData[i]['Date'])
data.append(yahooData[i]['Adj_Close'])
print(date[i], data[i], sep=' ')
# turns the two lists into a data frame
stock_data = pd.DataFrame({'Dates': date , 'Prices' : data})
stock_data
# Where things go to s**t
p = TimeSeries(stock_data, index = 'Dates', legend = 'True', title = "Stock Chart", ylabel = 'Prices')
output_file("Stock_chart.html")
show(p)
yields this error:
ImportError Traceback (most recent call last) in () 1 from yahoo_finance import Share 2 import pandas as pd ----> 3 from bokeh.charts import TimeSeries, output_file, show 4 5 # Getting stocks from Yahoo Finance
ImportError: cannot import name 'TimeSeries'