因此,在构造元组列表时,某些元组内的顺序似乎混杂在一起。 each_file[2]
内的内容将随机在内容each_file[1]
之前。从印刷文件列表输出元组随机切换顺序列表
实施例:
[{ef1, ef2}, {ef1, ef2} {ef2, ef1}, {ef1, ef2} ....]
约约下面的代码信息:
projectDict是pandas.dataframe对象的列表
filelist = []
for each_dict in projectDict:
currentDataFrame = projectDict[each_dict]
for each_file in currentDataFrame.itertuples():
important_terms = { each_file[1],
each_file[2]}
filelist.append(important_terms)
这是使用itertuples的结果,还是在我的代码中有另一个明显的错误?我用了iterrows并有同样的问题。我也已经证实,数据不是以输出的方式构成的。
'important_items'是一组,集合是无序的。 –
这些是**不是**元组,但是**集**和**集的顺序未确定**。 –
非常感谢,这是非常愚蠢的错误! – Matthew