Skip to content

Commit a8073d2

Browse files
committed
refac failing test_series_apply.py
1 parent a2bb285 commit a8073d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/tests/apply/test_series_apply.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ def test_apply_categorical_with_nan_values(series, by_row):
236236
with pytest.raises(AttributeError, match=msg):
237237
s.apply(lambda x: x.split("-")[0], by_row=by_row)
238238
return
239-
240-
result = s.apply(lambda x: x.split("-")[0], by_row=by_row)
239+
# NaN for cat dtype fixed in (GH 59966)
240+
result = s.apply(lambda x: x.split("-")[0] if pd.notna(x) else False, by_row=by_row)
241241
result = result.astype(object)
242-
expected = Series(["1", "1", np.nan], dtype="category")
242+
expected = Series(["1", "1", False], dtype="category")
243243
expected = expected.astype(object)
244244
tm.assert_series_equal(result, expected)
245245

0 commit comments

Comments
 (0)