【发布时间】:2022-10-07 13:52:10
【问题描述】:
考虑下面的示例,我正在尝试创建一个小的单分区图并将其导出到 pandas 数据框:
from pynock import Edge, Node, Partition
# create a new partition
p = Partition(part_id=1)
# add nodes to the partition
for k in range(3):
# create a node with an edge hardcoded to link to node 1
_node = Node(node_id=k, name=f\"{k}\")
_edge = Edge(node_id=1)
_node.add_edge(_edge)
# add the node to the partition
p.add_node(_node)
# convert to dataframe
p.to_df()
# will print an empty dataframe
当我使用print(p) 检查分区时,我可以看到节点已添加到分区中。为什么数据框是空的?