我正在使用 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 功能。我不确定为什么会出现这个错误。请帮忙!
慕娘9325324
相关分类