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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework