Skip to content

Pandas 3.2: DataFrame.iterrows is deprecated - #12724

Merged
crusaderky merged 2 commits into
dask:mainfrom
crusaderky:fix/pandas-iterrows-warning
Nov 13, 2026
Merged

crusaderky merged 2 commits into
dask:mainfrom
crusaderky:fix/pandas-iterrows-warning

Conversation

@crusaderky

@crusaderky crusaderky commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

The pandas nightly (3.2.0.dev0) deprecated DataFrame.iterrows:

pandas.errors.Pandas4Warning: DataFrame.iterrows is deprecated and will be removed in a future version. Use .itertuples instead.

This affects:

  • dask/dataframe/tests/test_dataframe.py::test_dataframe_iterrows
  • dask/dataframe/dask_expr/tests/test_collection.py::test_dataframe_iterrows

Change

  • Add a PANDAS_GE_320 version flag next to the existing PANDAS_GE_* flags in dask/_pandas_compat.py, re-exported from dask/dataframe/_compat.py.
  • In the two affected tests, assert that the deprecation reaches the caller on pandas 3.2 and later with pytest.warns(Pandas4Warning, match="iterrows is deprecated").

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

     29 files  ±0       29 suites  ±0   6h 21m 12s ⏱️ - 19m 5s
 19 929 tests ±0   18 500 ✅ ±0   1 429 💤 ±0  0 ❌ ±0 
436 258 runs  ±0  384 799 ✅  - 2  51 459 💤 +2  0 ❌ ±0 

Results for commit 7d98609. ± Comparison against base commit 025d6ac.

♻️ This comment has been updated with latest results.

@crusaderky
crusaderky force-pushed the fix/pandas-iterrows-warning branch from ab8f029 to 8b9db0e Compare November 13, 2026 14:03
The previous commit added a suite-wide ``filterwarnings`` ignore for the pandas
3.2 ``DataFrame.iterrows`` deprecation. Dask's ``iterrows`` yields from the
pandas implementation, so the warning is a real signal that dask exposes an API
which pandas is removing; a global ignore would also swallow it for any
unrelated test that touches ``iterrows``.

Revert the pyproject.toml ignore and instead gate the two affected tests on the
new ``PANDAS_GE_320`` flag, asserting with
``pytest.warns(Pandas4Warning, match="iterrows is deprecated")`` that the
deprecation reaches the caller on pandas 3.2 and later.
@crusaderky crusaderky changed the title [unsupervised AI] Ignore pandas DataFrame.iterrows deprecation in tests [unsupervised AI] Assert pandas DataFrame.iterrows deprecation in tests Nov 13, 2026
@crusaderky crusaderky changed the title [unsupervised AI] Assert pandas DataFrame.iterrows deprecation in tests Pandas 3.2: DataFrame.iterrows is deprecated Nov 13, 2026
@crusaderky
crusaderky marked this pull request as ready for review November 13, 2026 15:16
@crusaderky
crusaderky merged commit 10440c2 into dask:main Nov 13, 2026
36 of 38 checks passed
@crusaderky
crusaderky deleted the fix/pandas-iterrows-warning branch November 13, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant