1for index, row in df.iterrows():
2 print(row['c1'], row['c2'])
3
4Output:
5 10 100
6 11 110
7 12 120
1df = pd.DataFrame([{'c1':10, 'c2':100}, {'c1':11,'c2':110}, {'c1':12,'c2':120}])
2for index, row in df.iterrows():
3 print(row['c1'], row['c2'])
1import pandas as pd
2import numpy as np
3
4df = pd.DataFrame({'c1': [10, 11, 12], 'c2': [100, 110, 120]})
5
6for index, row in df.iterrows():
7 print(row['c1'], row['c2'])
8
1>>> df = pd.DataFrame([[1, 1.5]], columns=['int', 'float'])
2>>> row = next(df.iterrows())[1]
3>>> row
4int 1.0
5float 1.5
6Name: 0, dtype: float64
7>>> print(row['int'].dtype)
8float64
9>>> print(df['int'].dtype)
10int64
11