【发布时间】:2021-08-06 06:54:35
【问题描述】:
我有 3 天的货币兑换数据,间隔为 15 分钟。我将日期列更改为日期时间,在 matplotlib 中绘图时,它给出了 12 小时的 x 轴刻度。如何选择 3 小时的数据并以给定的 15 分钟时间间隔进行绘图?
plt.figure(figsize=(20, 10))
plt.plot(EURJPY['Date'],EURJPY['Close'])
plt.xticks(rotation='vertical')
plt.grid(True)
plt.show()
我也试过这段代码,但它给出的输出是 x 轴值作为行号。
EURJPY.loc[(EURJPY['Date'] > '07/05/2021 07:00') & (EURJPY['Date'] <= '07/05/2021 11:00')].plot(y='Close')
如何选择上午 9 点到下午 1 点的收盘价? 谢谢
【问题讨论】: