-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Drop fails when supplied with an object that implements __getitem__ #11740
Comments
I'm not sure about putting |
@kawochen have a look at Definitely agree putting iterables / list like objects in an index is not a good idea. |
I think I did follow. But I think the support would still be partial. I was thinking
(I am against making it easy to put |
Apologies @kawochen, I'm not sure I understand. What's that class for? |
@MaximilianR that is a class whose instances I think would still fail to be dropped after your proposed change, so some |
yeh And there are slight differences in the iterables & checking and its very very subtle (e.g. the |
When you supply
drop
with an item that implements__getitem__
,drop
doesn't drop it. It does when supplied with the item within a list.That's because instead of checking
is_list_like
(here),drop
calls_index_labels_to_array
which does this. That returns an empty list when supplied with an object that implements__getitem__
. (if you want the technicals, that's becauselist(obj) == []
, as__getitem__
used to be the way of implementing iteration.is_list_like
ignores that case, I think correctly).Should
_index_labels_to_array
instead callis_list_like
?The text was updated successfully, but these errors were encountered: