def itertuples(self, index: bool=True, name: Optional[str]='PandasOnSpark') -> Iterator[Tuple]:
    '\n        Iterate over DataFrame rows as namedtuples.\n\n        Parameters\n        ----------\n        index : bool, default True\n            If True, return the index as the first element of the tuple.\n        name : str or None, default "PandasOnSpark"\n            The name of the returned namedtuples or None to return regular\n            tuples.\n\n        Returns\n        -------\n        iterator\n            An object to iterate over namedtuples for each row in the\n            DataFrame with the first field possibly being the index and\n            following fields being the column values.\n\n        See Also\n        --------\n        DataFrame.iterrows : Iterate over DataFrame rows as (index, Series)\n            pairs.\n        DataFrame.items : Iterate over (column name, Series) pairs.\n\n        Notes\n        -----\n        The column names will be renamed to positional names if they are\n        invalid Python identifiers, repeated, or start with an underscore.\n        On python versions < 3.7 regular tuples are returned for DataFrames\n        with a large number of columns (>254).\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({\'num_legs\': [4, 2], \'num_wings\': [0, 2]},\n        ...                   index=[\'dog\', \'hawk\'])\n        >>> df\n              num_legs  num_wings\n        dog          4          0\n        hawk         2          2\n\n        >>> for row in df.itertuples():\n        ...     print(row)\n        ...\n        PandasOnSpark(Index=\'dog\', num_legs=4, num_wings=0)\n        PandasOnSpark(Index=\'hawk\', num_legs=2, num_wings=2)\n\n        By setting the `index` parameter to False we can remove the index\n        as the first element of the tuple:\n\n        >>> for row in df.itertuples(index=False):\n        ...     print(row)\n        ...\n        PandasOnSpark(num_legs=4, num_wings=0)\n        PandasOnSpark(num_legs=2, num_wings=2)\n\n        With the `name` parameter set we set a custom name for the yielded\n        namedtuples:\n\n        >>> for row in df.itertuples(name=\'Animal\'):\n        ...     print(row)\n        ...\n        Animal(Index=\'dog\', num_legs=4, num_wings=0)\n        Animal(Index=\'hawk\', num_legs=2, num_wings=2)\n        '
    fields = list(self.columns)
    if index:
        fields.insert(0, 'Index')
    index_spark_column_names = self._internal.index_spark_column_names
    data_spark_column_names = self._internal.data_spark_column_names

    def extract_kv_from_spark_row(row: Row) -> Tuple[(Name, Any)]:
        k = (row[index_spark_column_names[0]] if (len(index_spark_column_names) == 1) else tuple((row[c] for c in index_spark_column_names)))
        v = [row[c] for c in data_spark_column_names]
        return (k, v)
    can_return_named_tuples = ((sys.version_info >= (3, 7)) or ((len(self.columns) + index) < 255))
    if ((name is not None) and can_return_named_tuples):
        itertuple = namedtuple(name, fields, rename=True)
        for (k, v) in map(extract_kv_from_spark_row, self._internal.resolved_copy.spark_frame.toLocalIterator()):
            (yield itertuple._make((([k] if index else []) + list(v))))
    else:
        for (k, v) in map(extract_kv_from_spark_row, self._internal.resolved_copy.spark_frame.toLocalIterator()):
            (yield tuple((([k] if index else []) + list(v))))
Iterate over DataFrame rows as namedtuples.

Parameters
----------
index : bool, default True
    If True, return the index as the first element of the tuple.
name : str or None, default "PandasOnSpark"
    The name of the returned namedtuples or None to return regular
    tuples.

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.

See Also
--------
DataFrame.iterrows : Iterate over DataFrame rows as (index, Series)
    pairs.
DataFrame.items : Iterate over (column name, Series) pairs.

Notes
-----
The column names will be renamed to positional names if they are
invalid Python identifiers, repeated, or start with an underscore.
On python versions < 3.7 regular tuples are returned for DataFrames
with a large number of columns (>254).

Examples
--------
>>> df = ps.DataFrame({'num_legs': [4, 2], 'num_wings': [0, 2]},
...                   index=['dog', 'hawk'])
>>> df
      num_legs  num_wings
dog          4          0
hawk         2          2

>>> for row in df.itertuples():
...     print(row)
...
PandasOnSpark(Index='dog', num_legs=4, num_wings=0)
PandasOnSpark(Index='hawk', num_legs=2, num_wings=2)

By setting the `index` parameter to False we can remove the index
as the first element of the tuple:

>>> for row in df.itertuples(index=False):
...     print(row)
...
PandasOnSpark(num_legs=4, num_wings=0)
PandasOnSpark(num_legs=2, num_wings=2)

With the `name` parameter set we set a custom name for the yielded
namedtuples:

>>> for row in df.itertuples(name='Animal'):
...     print(row)
...
Animal(Index='dog', num_legs=4, num_wings=0)
Animal(Index='hawk', num_legs=2, num_wings=2)
def itertuples(self, index: bool=True, name: Optional[str]='PandasOnSpark') -> Iterator[Tuple]:
    '\n        Iterate over DataFrame rows as namedtuples.\n\n        Parameters\n        ----------\n        index : bool, default True\n            If True, return the index as the first element of the tuple.\n        name : str or None, default "PandasOnSpark"\n            The name of the returned namedtuples or None to return regular\n            tuples.\n\n        Returns\n        -------\n        iterator\n            An object to iterate over namedtuples for each row in the\n            DataFrame with the first field possibly being the index and\n            following fields being the column values.\n\n        See Also\n        --------\n        DataFrame.iterrows : Iterate over DataFrame rows as (index, Series)\n            pairs.\n        DataFrame.items : Iterate over (column name, Series) pairs.\n\n        Notes\n        -----\n        The column names will be renamed to positional names if they are\n        invalid Python identifiers, repeated, or start with an underscore.\n        On python versions < 3.7 regular tuples are returned for DataFrames\n        with a large number of columns (>254).\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({\'num_legs\': [4, 2], \'num_wings\': [0, 2]},\n        ...                   index=[\'dog\', \'hawk\'])\n        >>> df\n              num_legs  num_wings\n        dog          4          0\n        hawk         2          2\n\n        >>> for row in df.itertuples():\n        ...     print(row)\n        ...\n        PandasOnSpark(Index=\'dog\', num_legs=4, num_wings=0)\n        PandasOnSpark(Index=\'hawk\', num_legs=2, num_wings=2)\n\n        By setting the `index` parameter to False we can remove the index\n        as the first element of the tuple:\n\n        >>> for row in df.itertuples(index=False):\n        ...     print(row)\n        ...\n        PandasOnSpark(num_legs=4, num_wings=0)\n        PandasOnSpark(num_legs=2, num_wings=2)\n\n        With the `name` parameter set we set a custom name for the yielded\n        namedtuples:\n\n        >>> for row in df.itertuples(name=\'Animal\'):\n        ...     print(row)\n        ...\n        Animal(Index=\'dog\', num_legs=4, num_wings=0)\n        Animal(Index=\'hawk\', num_legs=2, num_wings=2)\n        '
    fields = list(self.columns)
    if index:
        fields.insert(0, 'Index')
    index_spark_column_names = self._internal.index_spark_column_names
    data_spark_column_names = self._internal.data_spark_column_names

    def extract_kv_from_spark_row(row: Row) -> Tuple[(Name, Any)]:
        k = (row[index_spark_column_names[0]] if (len(index_spark_column_names) == 1) else tuple((row[c] for c in index_spark_column_names)))
        v = [row[c] for c in data_spark_column_names]
        return (k, v)
    can_return_named_tuples = ((sys.version_info >= (3, 7)) or ((len(self.columns) + index) < 255))
    if ((name is not None) and can_return_named_tuples):
        itertuple = namedtuple(name, fields, rename=True)
        for (k, v) in map(extract_kv_from_spark_row, self._internal.resolved_copy.spark_frame.toLocalIterator()):
            (yield itertuple._make((([k] if index else []) + list(v))))
    else:
        for (k, v) in map(extract_kv_from_spark_row, self._internal.resolved_copy.spark_frame.toLocalIterator()):
            (yield tuple((([k] if index else []) + list(v))))