| 2388 | |
| 2389 | |
| 2390 | def test_bfill(): |
| 2391 | df = _compat.makeMissingDataFrame() |
| 2392 | ddf = dd.from_pandas(df, npartitions=5, sort=False) |
| 2393 | |
| 2394 | assert_eq(ddf.bfill(), df.bfill()) |
| 2395 | assert_eq(ddf.A.bfill(), df.A.bfill()) |
| 2396 | |
| 2397 | assert_eq(ddf.bfill(limit=2), df.bfill(limit=2)) |
| 2398 | assert_eq(ddf.A.bfill(limit=2), df.A.bfill(limit=2)) |
| 2399 | |
| 2400 | df = _compat.makeMissingDataFrame() |
| 2401 | df.iloc[:15, 0] = np.nan # all NaN partition |
| 2402 | ddf = dd.from_pandas(df, npartitions=5, sort=False) |
| 2403 | pytest.raises(ValueError, lambda: ddf.bfill().compute()) |
| 2404 | assert_eq(df.bfill(limit=3), ddf.bfill(limit=3)) |
| 2405 | |
| 2406 | |
| 2407 | @pytest.mark.parametrize("optimize", [True, False]) |