How to iterate over rows of a Pandas DataFrame in Python

A Pandas DataFrame is iterated over as (index, Series) pairs.

Solution for How to iterate over rows of a Pandas DataFrame in Python : You can use pd.DataFrame.iterrows() to iterate over a Pandas DataFrame Call pd.DataFrame.iterrows() to return a generator of rows. Use the generator to iterate over the rows of the DataFrame.


how-to-iterate-over-rows-of-a-pandas-dataframe-in-python