-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Description
When writing this SO answer, I came upon this behavior, which I did not expect.
In [1]: 1 in Series([1]) Out[1]: False In [2]: 1 in Series([1, 2]) Out[2]: True Apparently, __contains__ looks at the index.
In [3]: 1 in Series([1], index=[1]) Out[3]: True I can see how that makes sense. But I think it's fair to say that it is potentially confusing. Do we rely on this behavior of __contains__ for data alignment? Might it be reasonable to change it? I'm not sure that's a good idea, but I want to raise the issue.