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# creating a list of dataframe columns
2columns = list(df)
3
4for i in columns:
5
6 # printing the third element of the column
7 print (df[i][2])