我有一个如下所示的数据框,并使用Python 2.7 Matplotlib 2.2.3
time,Actual,Predicted
2018-11-02 21:00:00,40.475155279503156,76.8949003568263
2018-11-02 22:00:00,51.73913043478258,110.99504319790344
2018-11-02 23:00:00,200.439393939394,151.33496657268998
2018-11-03 00:00:00,30.227272727272663,58.8695018735155
2018-11-03 01:00:00,0.50397381954181,159.2188810691594
下面是代码段
fth = pd.io.parsers.read_csv('water_ac_pr.csv',index_col='time')
#other processing
fth = fth.reset_index(level=0)
ax = pyplot.gca()
fth[['time','Actual']].plot(ax=ax,x='time',kind='bar')
fth[['time','Predicted']].plot(x='time',ax=ax,kind='line',color='red')
ax.xaxis.set_major_locator(dates.HourLocator(byhour=(0,12)))
pyplot.show()
即使没有显示股票行情,我也能够获得复合折线图 但是,如果我将parse_dates添加到read_csv,则折线图不可见并且代码错误
fth = pd.io.parsers.read_csv('water_ac_pr.csv',index_col='time',
parse_dates=[0])
有人可以建议parse_date是什么问题,我需要将其用于其他处理。还有如何正确显示股票行情