| 3392 | |
| 3393 | |
| 3394 | def test_dataframe_iterrows(): |
| 3395 | df = pd.DataFrame({"x": [1, 2, 3, 4], "y": [10, 20, 30, 40]}) |
| 3396 | ddf = dd.from_pandas(df, npartitions=2) |
| 3397 | |
| 3398 | if PANDAS_GE_320: |
| 3399 | # pandas 3.2 deprecated DataFrame.iterrows. Dask yields from the pandas |
| 3400 | # implementation, so the warning must surface rather than be suppressed. |
| 3401 | from pandas.errors import Pandas4Warning |
| 3402 | |
| 3403 | ctx = pytest.warns(Pandas4Warning, match="iterrows is deprecated") |
| 3404 | else: |
| 3405 | ctx = contextlib.nullcontext() |
| 3406 | |
| 3407 | with ctx: |
| 3408 | for a, b in zip(df.iterrows(), ddf.iterrows()): |
| 3409 | tm.assert_series_equal(a[1], b[1]) |
| 3410 | |
| 3411 | |
| 3412 | def test_dataframe_itertuples(): |