Closed
Description
perf discussion: http://stackoverflow.com/questions/24870953/does-iterrows-have-performance-issues/24871316#24871316
import pandas as pd
df = pd.DataFrame({'a':range(5),'b':range(5)})
print df
for _, row in df.iterrows():
row.a += 1
print df
df['c'] = 'what'
for _, row in df.iterrows():
row.b += 1
print df
a b
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
[5 rows x 2 columns]
a b
0 1 0
1 2 1
2 3 2
3 4 3
4 5 4
[5 rows x 2 columns]
a b c
0 1 0 what
1 2 1 what
2 3 2 what
3 4 3 what
4 5 4 what
[5 rows x 3 columns]