【发布时间】:2018-04-23 17:28:21
【问题描述】:
最近我开始使用散景库进行数据可视化。我的任务是通过 python 将 CSV 数据转换为图形。我在这里面临一些问题。下面是我的环境结构和问题。
环境
- python = 2.7.14
- 散景 = 0.12.13
问题描述
我需要从名为“data.csv”的 CSV 文件中获取数据。我的文件结构是这样的: Id,upbyte,downbyte,时间“时间戳”。我需要帮助来使用 figure.multi_line 删除数据。我抓住了机会,但数据仍然没有像我想要的那样。
我的代码:
def run_graph():
df = pandas.read_csv("/Users/path/fetch_data.csv",parse_dates["StatTime"])
p = Figure(width=500, height=250, x_axis_type="datetime", responsive=True,
tools="pan, box_zoom, wheel_zoom, save, reset",logo =None,
title="Graph:", x_axis_label="Time Frame", y_axis_label="Traffic")
timeFrame = df["Time"]
upbyte = df["up"]
downbyte = df["Down"]
protocolname = df["Name"]
p.multi_line(x = [timeFrame, upbyte], y = [timeFrame, downbyte], color=['Red', 'green'], line_width=1)
p.circle(x = [timeFrame, upbyte], y = [timeFrame, downbyte], fill_color='orange', size=6)
output_file("/Users/path/graph.html", title="Reports")
show(p)
run_graph()
错误
脚本错误是: 错误:TypeError:multiline() 只需要 3 个参数(给定 1 个)
我希望每个人都清楚我的问题。如果没有,请让我知道为您提供更多详细信息。提前谢谢你。
【问题讨论】:
标签: python python-2.7 data-visualization bokeh