Skip to content

BUG: allow empty multiindex (fixes .isin regression, GH16777) #16782

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

Merged
merged 11 commits into from
Jul 7, 2017
Prev Previous commit
Next Next commit
Split empty from_tuples test
  • Loading branch information
Douglas Rudd authored and jreback committed Jul 7, 2017
commit 39b544a7aa0727dea62a64d56ca43b72676ae423
7 changes: 4 additions & 3 deletions pandas/tests/indexes/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1717,14 +1717,15 @@ def test_from_tuples(self):
'from empty list',
MultiIndex.from_tuples, [])

idx = MultiIndex.from_tuples(((1, 2), (3, 4)), names=['a', 'b'])
assert len(idx) == 2

def test_from_tuples_empty(self):
result = MultiIndex.from_tuples([], names=['a', 'b'])
expected = MultiIndex.from_arrays(arrays=[[], []],
names=['a', 'b'])
tm.assert_index_equal(result, expected)

idx = MultiIndex.from_tuples(((1, 2), (3, 4)), names=['a', 'b'])
assert len(idx) == 2

def test_argsort(self):
result = self.index.argsort()
expected = self.index.values.argsort()
Expand Down