Skip to content

Commit aced6ee

Browse files
authored
TST: Adding test to series\indexing\test_indexing (#18579) (#44165)
1 parent 854c60f commit aced6ee

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/series/indexing/test_indexing.py

+14
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,17 @@ def test_frozenset_index():
377377
assert s[idx1] == 2
378378
s[idx1] = 3
379379
assert s[idx1] == 3
380+
381+
382+
def test_boolean_index():
383+
# GH18579
384+
s1 = Series([1, 2, 3], index=[4, 5, 6])
385+
s2 = Series([1, 3, 2], index=s1 == 2)
386+
tm.assert_series_equal(Series([1, 3, 2], [False, True, False]), s2)
387+
388+
389+
def test_index_ndim_gt_1_raises():
390+
# GH18579
391+
df = DataFrame([[1, 2], [3, 4], [5, 6]], index=[3, 6, 9])
392+
with pytest.raises(ValueError, match="Index data must be 1-dimensional"):
393+
Series([1, 3, 2], index=df)

0 commit comments

Comments
 (0)