How can I iterate over rows in a Pandas DataFrame?
https://stackoverflow.com/questions/16476924/how-can-i-iterate-over-rows-in-a-pandas-dataframe
WEBThere are so many ways to iterate over the rows in Pandas dataframe. One very simple and intuitive way is: df = pd.DataFrame({'A':[1, 2, 3], 'B':[4, 5, 6], 'C':[7, 8, 9]}) print(df) for i in range(df.shape[0]): # For printing the second column print(df.iloc[i, 1]) # For printing more than one columns print(df.iloc[i, [0, 2]])
DA: 50 PA: 92 MOZ Rank: 54 Up or Down: Up