#创建一个空的Dataframe
result =pd.DataFrame(columns=('idx','degree','weight','diameter'))
#将计算结果逐行插入result,注意变量要用[]括起来,同时ignore_index=True,否则会报错,ValueError: If using all scalar values, you must pass an index
for i in idx:
degree=
weight=
diameter=
result=result.append(pd.DataFrame({'idx':[i],'degree':[degree],'weight':[weight],'diameter':[diameter]}),ignore_index=True)