因此,在構造元組列表時,某些元組內的順序似乎混雜在一起。 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