import pandas as pd # Create a sample DataFrame df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}) # Iterate over the rows of the DataFrame for index, row in df.iterrows(): # Access data for each column by column name print(row['A'], row['B'])
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.