-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
DOC: definition of a scalar in rich comparison methods #62191
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
base: main
Are you sure you want to change the base?
DOC: definition of a scalar in rich comparison methods #62191
Conversation
Anything can be an element of a series. |
Hi @jbrockmendel, thank you for the quick review. The original docs can potentially imply that only scalars recognised by Pandas can be accepted as arguments in This is not true. An Enum, for example, fails the This PR aims to remove the potential misinterpretation of the original documentation. |
pandas/core/series.py
Outdated
@@ -6072,7 +6072,7 @@ def eq( | |||
|
|||
Parameters | |||
---------- | |||
other : Series or scalar value | |||
other : Series or scalar value (that can be the element of a Series) |
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.
The parentheses added here do not help the issue since any Python object can be an element of a Series (even a Series itself can be an element of a Series!). We want to indicate that this method treats lists, tuples, ndarrays, and Series differently from any other Python object. Namely, these types will be evaluated element-by-element whereas every other Python object will be evaluated as a whole against each element of the caller.
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.
288f06e does it look better?
@cmp0xff - see #62063 (comment) |
Hi, I adapted the new idea and added a test. |
This was inspired by #62063 (comment) and will relax the philosophical tension that caused the closure of pandas-dev/pandas-stubs#1288.