Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pandas/tests/frame/methods/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,19 @@ def test_fillna_categorical_nan(self):
df = DataFrame({"a": Categorical(idx)})
tm.assert_frame_equal(df.fillna(value=NaT), df)

def test_fillna_with_categorical_series(self):
df = DataFrame(
{"cats": Categorical(["A", "B", "C"]), "ints": [1.0, 2.0, np.nan]}
)

filler = Series(Categorical([10.0, 20.0, 30.0]))
df.fillna({"ints": filler}, inplace=True)

expected = DataFrame(
{"cats": Categorical(["A", "B", "C"]), "ints": [1.0, 2.0, 30.0]}
)
tm.assert_frame_equal(df, expected)

def test_fillna_no_downcast(self, frame_or_series):
# GH#45603 preserve object dtype
obj = frame_or_series([1, 2, 3], dtype="object")
Expand Down
Loading