Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Adding tests for checking Boolean series and df as indexes for series #44165

Merged
merged 1 commit into from
Oct 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,17 @@ def test_frozenset_index():
assert s[idx1] == 2
s[idx1] = 3
assert s[idx1] == 3


def test_boolean_index():
# GH18579
s1 = Series([1, 2, 3], index=[4, 5, 6])
s2 = Series([1, 3, 2], index=s1 == 2)
tm.assert_series_equal(Series([1, 3, 2], [False, True, False]), s2)


def test_index_ndim_gt_1_raises():
# GH18579
df = DataFrame([[1, 2], [3, 4], [5, 6]], index=[3, 6, 9])
with pytest.raises(ValueError, match="Index data must be 1-dimensional"):
Series([1, 3, 2], index=df)