Skip to content

Commit 6658da9

Browse files
committed
TST: Adding test to series\indexing\test_indexing (pandas-dev#18579)
1 parent 8969a58 commit 6658da9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/series/indexing/test_indexing.py

+16
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,19 @@ 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+
assert not s2.index[0]
387+
assert s2.index[1]
388+
assert not s2.index[2]
389+
390+
391+
def test_index_ndim_gt_1_raises():
392+
# GH18579
393+
df = DataFrame([[1, 2], [3, 4], [5, 6]], index=[3, 6, 9])
394+
with pytest.raises(ValueError, match="Index data must be 1-dimensional"):
395+
Series([1, 3, 2], index=df)

0 commit comments

Comments
 (0)