matplotlib - Blank Candlestick Chart Python -


stock market predictor

https://ntguardian.wordpress.com/2016/09/19/introduction-stock-market-data-python-1/we

%matplotlib inline %pylab inline import pandas pd import numpy np import matplotlib.pyplot plt import matplotlib.ticker mticker matplotlib.finance import candlestick_ohlc  import matplotlib.dates mdates import datetime dt   import pandas_datareader.data wb import datetime import matplotlib.pyplot plt  start = datetime.datetime(2014,1,1) end = datetime.date.today()  #apple = wb.datareader('appl','google', start,end) apple = wb.get_data_google('tsla')  apple.reset_index(level=0, inplace=true)  df = apple #print(df) df['date'] = df['date'].map(mdates.date2num)  open = df['open'].values.tolist() close = df['close'].values.tolist()   high = df['high'].values.tolist() low = df['low'].values.tolist()  fig = plt.figure() fig.subplots_adjust(bottom=0.1)  ax = fig.add_subplot(111) ax.set_xlim([datetime.datetime(2014,1,1), datetime.date.today()]) fig.autofmt_xdate() matplotlib.finance.candlestick2_ohlc(ax,open, close, high, low, width=4, colorup='r', colordown='k',alpha=0.75) plt.ylabel("price")   plt.legend() plt.show() 

it seems code runs without error, plot presents not have data in it. has appropriate y labels , x labels, no data. feel inputs (open, close, high, low) not correct. these 4 outputs formatted dataframes, tried format list.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -