show error in package
File "D:\New folder (2)\lib\site-packages\mpl_finance.py", line 302, in _candlestick
xy=(t - OFFSET, lower),
TypeError: unsupported operand type(s) for -: 'Timestamp' and 'float'
how to solve
Could you please send the code which throws this error.
import datetime as dt
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas_datareader as web
from mpl_finance import candlestick_ohlc
start=dt.datetime(2010,1,1)
end=dt.datetime.now()
value=input(print("Enter stock symbol:"))
df=web.DataReader(value,'yahoo',start,end)
df=df[['Open','High','Low','Close']]
df.reset_index(inplace=True)
df['Date'] = df['Date'].map(mdates.date2num)
ax=plt.subplot()
candlestick_ohlc(ax,df.values,width=5,colorup='g',colordown='r')
ax.axis_date()
ax.grid(True)
print(plt.show())
print(df.head())
'AxesSubplot' object has no attribute 'axis_date'
Try replacing ax.axis_date() with ax.xaxis_date().