Pandas DataFrame: itertuples() function
DataFrame - itertuples() function
The itertuples() function is used to iterate over DataFrame rows as namedtuples.
Syntax:DataFrame.itertuples(self, index=True, name='Pandas')
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
index | If True, return the index as the first element of the tuple. | bool Default Value: True |
Required |
name | The name of the returned namedtuples or None to return regular tuples. | str or None Default Value: “Pandas” |
Required |
Returns: iterator
An object to iterate over namedtuples for each row in the DataFrame with the first field possibly being the index and following fields being the column values.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - iterrows() function
Next: DataFrame - lookup() 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