Pandas DataFrame: iterrows() function
DataFrame - iterrows() function
The iterrows() function is used to iterate over DataFrame rows as (index, Series) pairs.
Iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.
Syntax:DataFrame.iterrows(self)
Yields:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
index | The index of the row. A tuple for a MultiIndex. | label or tuple of label | Required |
data | The data of the row as a Series. | Series | Required |
it | A generator that iterates over the rows of the frame. | generator | Required |
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - iteritems() function
Next: DataFrame - itertuples() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/pandas/dataframe/dataframe-iterrows.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics