-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Labels
Milestone
Description
This means that patterns such as:
if my_frame.index:
# do somethingwith my_frame having a MultiIndex will never enter the if block. One can check that bool(my_frame.index) returns False. A single index (pandas.Index) will (correctly IMO) raise a ValueError warning that the truth value of an array is ambiguous. However, a MultiIndex fails silently.
This is such an awesome source of silent bugs that I'm surprised this hasn't come up before. Is there any reason why we want bool to return False every time for a MultiIndex?