dd = pd.DataFrame({"1":[1,2,3], "2":[20,30,40]})
print(dd)
for index, row in dd.iterrows():
val = row["1"]
dd.iloc[index]["2"] = val * 100
print("---------------------------")
print(dd)
结果:
1 2
0 1 20
1 2 30
2 3 40
---------------------------
1 2
0 1 100
1 2 200
2 3 300