|
@@ -96,7 +96,16 @@ def t8():
|
|
|
print(df)
|
|
|
|
|
|
|
|
|
-t8()
|
|
|
+# DataFrame循环遍历
|
|
|
+def t9():
|
|
|
+ df = pd.DataFrame({'a': [1, 2, 3], 'b': [3, 4, 5]})
|
|
|
+ for row in df.itertuples():
|
|
|
+ # print("the index", row.Index)
|
|
|
+ print(row)
|
|
|
+ print("sum of row", row.a + row.b)
|
|
|
+
|
|
|
+
|
|
|
+t9()
|
|
|
|
|
|
# result = pd.DataFrame(columns=list(["instanceid", "machineid"]), data=list())
|
|
|
|