Skip to content

Commit 5410f2d

Browse files
authored
TST: add test_ffill_with_string_column (#40557)
1 parent b2628b0 commit 5410f2d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/groupby/test_missing.py

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ def test_ffill_missing_arguments():
4343
df.groupby("b").fillna()
4444

4545

46+
@pytest.mark.parametrize(
47+
"method, expected", [("ffill", [None, "a", "a"]), ("bfill", ["a", "a", None])]
48+
)
49+
def test_fillna_with_string_dtype(method, expected):
50+
# GH 40250
51+
df = DataFrame({"a": pd.array([None, "a", None], dtype="string"), "b": [0, 0, 0]})
52+
grp = df.groupby("b")
53+
result = grp.fillna(method=method)
54+
expected = DataFrame({"a": pd.array(expected, dtype="string")})
55+
tm.assert_frame_equal(result, expected)
56+
57+
4658
def test_fill_consistency():
4759

4860
# GH9221

0 commit comments

Comments
 (0)