AttributeError:类型对象“Graph”没有属性“DataFrame”

我正在使用 python-igraph。


运行以下代码:


import pandas as pd

d = {'col1':[1, 2, 3, 4, 5], 'col2':[11, 12, 13, 14, 15]}

ct = pd.DataFrame(data=d)

from igraph import Graph, plot

g = Graph.DataFrame(edges=ct)

layout = g.layout('tree')

plot(g, layout = layout)

它抛出 rhis 错误:


---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-30-fc1ba82e7692> in <module>

      1 from igraph import *

----> 2 g = Graph.DataFrame(edges=ct)

      3 layout = g.layout('tree')

      4 plot(g, layout = layout)


AttributeError: type object 'Graph' has no attribute 'DataFrame'

但在python-igraph 的文档中,实现了 DataFrame 功能。我不确定为什么会出现这个错误。请帮忙!



偶然的你
浏览 148回答 1
1回答

慕娘9325324

该文档比已经实现的文档要新一些。新版本将于下周发布,届时该功能将可用。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python