我试图从未加权的二部图中删除自循环,但是我的代码只打印前2行(作为单行),循环的每次迭代都打印这2行(作为单行)。我对熊猫很陌生,可能会犯一些循环错误。你知道吗
我试过只迭代索引,只迭代行,但最终结果是一样的。你知道吗
代码:
for index,row in dataset.iterrows():
x = next(dataset.iterrows())
y=x[1].to_string().split()
if ((y[0])!=(y[1])):
outfile.write(x[1].to_string() + "\n")
输入:
% bip unweighted
1 1
1 2
1 3
1 4
...
实际值:
% bip unweighted 1 1
% bip unweighted 1 1
% bip unweighted 1 1
...
预期的:
% bip unweighted
1 2
1 3
1 4
...
目前没有回答
相关问题 更多 >
编程相关推荐