Skip to content

Commit 0437f68

Browse files
TST: add test for series list indexing with missing values (#27362)
1 parent c633579 commit 0437f68

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/indexing/test_loc.py

+12
Original file line numberDiff line numberDiff line change
@@ -1069,3 +1069,15 @@ def test_series_indexing_zerodim_np_array(self):
10691069
s = Series([1, 2])
10701070
result = s.loc[np.array(0)]
10711071
assert result == 1
1072+
1073+
1074+
def test_series_loc_getitem_label_list_missing_values():
1075+
# gh-11428
1076+
key = np.array(
1077+
["2001-01-04", "2001-01-02", "2001-01-04", "2001-01-14"], dtype="datetime64"
1078+
)
1079+
s = Series([2, 5, 8, 11], date_range("2001-01-01", freq="D", periods=4))
1080+
expected = Series([11.0, 5.0, 11.0, np.nan], index=key)
1081+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
1082+
result = s.loc[key]
1083+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)