点击运行
import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(4,3),columns = ['col1','col2','col3']) print("DataFrame Data:") print(df) for index, row in df.iterrows(): row['a'] = 10 print("Modified Data:") print(df)
运行结果 :
正在执行...