-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Changes from 1 commit
17204a6
474ff40
64908e8
76967db
c84f0bc
f94d2b4
fe1e043
b0778f0
e3d670a
39b544a
94ac6b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…tests pass despite issue #16844
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,14 +766,6 @@ def test_from_arrays_empty(self): | |
ValueError, "Must pass non-zero number of levels/labels"): | ||
MultiIndex.from_arrays(arrays=[]) | ||
|
||
# 0 levels, names defined | ||
result = MultiIndex.from_arrays(arrays=[], | ||
names=['A', 'B']) | ||
expected = MultiIndex(levels=[[], []], | ||
labels=[[], []], | ||
names=['A', 'B']) | ||
tm.assert_index_equal(result, expected) | ||
|
||
# 1 level | ||
result = MultiIndex.from_arrays(arrays=[[]], names=['A']) | ||
expected = Index([], name='A') | ||
|
@@ -1726,9 +1718,8 @@ def test_from_tuples(self): | |
MultiIndex.from_tuples, []) | ||
|
||
result = MultiIndex.from_tuples([], names=['a', 'b']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similary I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, IMO this should not work here, as in this case you actually do pass 2 values, but empty values (not an empty container holding no values). So IMO this should raise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with this. It should raise because you have a mismatch between the names and what you passe 8000 d. If you had NOT passed an empty list it would be ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make the empty case a separately named test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
expected = MultiIndex(levels=[[], []], | ||
labels=[[], []], | ||
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']) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing a lint issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.