【发布时间】:2017-05-16 15:03:44
【问题描述】:
问题:
如何根据下面在top_5 变量中捕获的sort_values 标准向plot 添加水平线。:
数据:
这是 CSV 中 data 的一部分:
这是当前情节。
axnum = today_numBars_slice[['High','Low']].plot()
axnum.yaxis.set_major_formatter(FormatStrFormatter('%.2f'))
这是我要添加到该图中的数据(每行的 High 和 Low 值):
top_5 = today_numBars_slice[['High','Low','# of Trades']].sort_values(by='# of Trades',ascending=False).head()
top_5
High Low # of Trades
Timestamp
2017-01-02 12:55:09.100 164.88 164.84 470
2017-01-02 12:10:12.000 164.90 164.86 465
2017-01-02 12:38:59.000 164.90 164.86 431
2017-01-02 11:54:49.100 164.87 164.83 427
2017-01-02 10:52:26.000 164.60 164.56 332
期望的输出:
这是所需输出的示例,显示了 top_5 中的两行:
【问题讨论】:
标签: python loops pandas matplotlib lines