# dask.dataframe.DataFrame.iterrows

#### DataFrame.iterrows()

Iterate over DataFrame rows as (index, Series) pairs.

This docstring was copied from pandas.DataFrame.iterrows.

Some inconsistencies with the Dask version may exist.

Each row is yielded as a (index, Series) tuple; the Series has
the same index as the DataFrame columns. Note that dtypes may
not be preserved across rows. Prefer [`itertuples()`](dask.dataframe.DataFrame.itertuples.html.md#dask.dataframe.DataFrame.itertuples) for
speed and type consistency.

* **Yields:**
  **index**
  : The index of the row. A tuple for a MultiIndex.

  **data**
  : The data of the row as a Series.

#### SEE ALSO
[`DataFrame.itertuples`](dask.dataframe.DataFrame.itertuples.html.md#dask.dataframe.DataFrame.itertuples)
: Iterate over DataFrame rows as namedtuples of the values.

[`DataFrame.items`](dask.dataframe.DataFrame.items.html.md#dask.dataframe.DataFrame.items)
: Iterate over (column name, Series) pairs.

### Notes

1. Because `iterrows` returns a Series for each row,
   it does **not** preserve dtypes across the rows (dtypes are
   preserved across columns for DataFrames).

   To preserve dtypes while iterating over the rows, it is better
   to use [`itertuples()`](dask.dataframe.DataFrame.itertuples.html.md#dask.dataframe.DataFrame.itertuples) which returns namedtuples of the values
   and which is generally faster than `iterrows`.
2. You should **never modify** something you are iterating over.
   This is not guaranteed to work in all cases. Depending on the
   data types, the iterator returns a copy and not a view, and writing
   to it will have no effect.

### Examples

```pycon
>>> df = pd.DataFrame([[1, 1.5]], columns=["int", "float"])
>>> row = next(df.iterrows())[1]
>>> row
int      1.0
float    1.5
Name: 0, dtype: float64
>>> print(row.dtype)
float64
>>> print(df["int"].dtype)
int64
```

<!-- !! processed by numpydoc !! -->
