我从书中读到,时间序列可以绘制基准时间,但是当我绘制一些股票信息时,我想在X轴上显示时间,但x轴没有任何内容,这是我的代码,而pic是我的情节,在x轴上显示,注意到这里,它有什么问题?
import numpy as np
import pandas as pd
from pandas_datareader import data as web
import matplotlib.pyplot as plt
import matplotlib
import tushare as ts
import bs4
data = pd.DataFrame()
data = ts.get_hist_data('600048',start='2017-01-05')
data['close'].plot(style = 'r', lw=2.)
print(data.head())
# ( data / data.ix[0] * 100 ).plot(figsize =(8, 5))
plt.show()
其输出:
open high close low volume price_change p_change
date
2018-05-18 13.63 13.89 13.89 13.52 433132.31 0.29 2.13
2018-05-17 13.65 13.92 13.62 13.58 417857.84 -0.03 -0.22
2018-05-16 13.85 13.93 13.64 13.60 489171.94 -0.32 -2.29
2018-05-15 13.77 13.97 13.96 13.61 472956.09 0.24 1.75
2018-05-14 13.83 14.00 13.73 13.51 488781.00 0.03 0.22