Skip to content

Commit 7611f59

Browse files
committed
Add test for a list with np.nan
1 parent 915b8a7 commit 7611f59

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: pandas/tests/series/indexing/test_where.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._libs.missing import NA
5+
46
from pandas.core.dtypes.common import is_integer
57

68
import pandas as pd
@@ -443,3 +445,13 @@ def test_where_datetimelike_categorical(tz_naive_fixture):
443445
res = pd.DataFrame(lvals).where(mask[:, None], pd.DataFrame(rvals))
444446

445447
tm.assert_frame_equal(res, pd.DataFrame(dr))
448+
449+
450+
def test_where_list_with_nan():
451+
ser = Series([None, 1, 2, np.nan, 3, 4, NA])
452+
cond = [np.nan, False, False, np.nan, True, True, np.nan]
453+
expected = Series([None, -99, -99, np.nan, 3, 4, NA])
454+
455+
res = ser.where(cond, -99)
456+
457+
tm.assert_series_equal(res, expected)

0 commit comments

Comments
 (0)