我有一个零和一个列表 . (1是高于平均水平,0是低于平均水平)我试图制作一个无向图,但我一直在

test = (ustest[states] > final).astype(int)
test2 = test.unstack()#this is still a series
test3 = test2.tolist()#this is the series converted to a list


usmap = nx.Graph()
usmap = usmap.add_edges_from(test3)

我一直得到"TypeError: object of type 'int' has no len()"但我不确定我做错了什么 . 我试图让这个列表成为图中的边缘 . EDIT

文件“//anaconda/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py”,第866行,在runfile execfile(文件名,命名空间)文件“//anaconda/lib/python3.6 /site-packages/spyder/utils/site/sitecustomize.py“,第102行,在execfile exec中(compile(f.read(),filename,'exec'),namespace)文件”/ Users / dshadow / Desktop / usstates .py“,第53行,在usmap = usmap.add_edges_from(test3)文件”//anaconda/lib/python3.6/site-packages/networkx/classes/graph.py“,第857行,在add_edges_from ne = len( e)TypeError:'int'类型的对象没有len()