Dataframe Iterrows Is A Generator Which Yields Both The Index

[Solved] Dataframe Iterrows Is A Generator Which Yields Both The Index | Python - Code Explorer | yomemimo.com
Question : DataFrame.iterrows is a generator which yields both the index and row (as a Series):

Answered by : morteza-abdipourchenarestansofla

import pandas as pd
df = pd.DataFrame({'c1': [10, 11, 12], 'c2': [100, 110, 120]})
for index, row in df.iterrows(): print(row['c1'], row['c2'])

Source : https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas | Last Update : Sun, 24 Jan 21

Answers related to dataframe iterrows is a generator which yields both the index and row as a series

Code Explorer Popular Question For Python