You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifis_list_like(levels[0]):
raiseTypeError("Levels must be list-like")
should probably be
iflen(levels) >0andis_list_like(levels[0]):
raiseTypeError("Levels must be list-like")
While I'm looking at this, a couple other questiosn:
How come we only check the first element? What if levels looks like ['a', ['b']]? I think we need to do any(is_list_like(x) for x in levels), which has the additional benefit that empty levels are handled correctly.
Can we make the TypeError message more precise? Maybe something like ValueError("Levels must not contain list-like items")
The text was updated successfully, but these errors were encountered:
MultiIndex
es with empty levels are valid, butset_levels
does not account for that case:The
set_levels
code that looks likeshould probably be
While I'm looking at this, a couple other questiosn:
['a', ['b']]
? I think we need to doany(is_list_like(x) for x in levels)
, which has the additional benefit that empty levels are handled correctly.TypeError
message more precise? Maybe something likeValueError("Levels must not contain list-like items")
The text was updated successfully, but these errors were encountered: