Python和dygraph no len

2024-10-03 19:22:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Python和dygraph是完全陌生的,但是我尝试重现这里提到的第一个示例: https://pypi.python.org/pypi/dyplot

我下载了这个包并将其复制到Anaconda目录中,这样IPython代码就可以准确地识别它。但是,复制的代码会引发一个错误:

import pandas as pd
from dyplot.dygraphs import Dygraphs
dg = Dygraphs(a.index, "index")
dg.plot(series="a", mseries=a)
dg.plot(series="b", mseries=b)
dg.plot(series="c", mseries=c,lseries=lc, hseries=hc)
dg.set_options(title="Test")
div = dg.savefig(csv_file="tutorial.csv", html_file="tutorial1.html")

enter image description here

有人知道这个问题的线索吗? 我使用python3.4

非常感谢


Tags: csv代码importpypiindexplothtmlfile
1条回答
网友
1楼 · 发布于 2024-10-03 19:22:44

你需要有a,b,c,lc和hc作为熊猫系列。在上次导入后插入这些行。在

a = pd.Series([1,2,3,4,5,6,7,9,10])
b = pd.Series([1,3,5,9,2,8,5,5,15])
lc= pd.Series([1,3,4,5,6,7,9,3,2])
c = pd.Series([2,4,5,7,8,8,9,4,3])
hc= pd.Series([3,5,7,7,9,11,9,5,8])

检查http://dyplot.readthedocs.org/en/latest/tutorials.html

相关问题 更多 >