Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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