-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: inspect.getmembers(Series) #38782
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
Conversation
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -302,7 +302,7 @@ ExtensionArray | |||
Other | |||
^^^^^ | |||
|
|||
- | |||
- ``inspect.getmembers(Series)`` no longer raises an ``AbstractMethodError`` (:issue:`38782`). |
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.
note we backported the other issue. ok for this too.
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.
remove from here
original, such as DataFrame single columns slicing. | ||
""" | ||
raise AbstractMethodError(self) | ||
|
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.
This isn't used on Series. Calling it on a Series should just result in an AttributeError.
1e46304
to
eeef0ef
Compare
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -302,7 +302,7 @@ ExtensionArray | |||
Other | |||
^^^^^ | |||
|
|||
- | |||
- ``inspect.getmembers(Series)`` no longer raises an ``AbstractMethodError`` (:issue:`38782`). |
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.
remove from here
Note there was quite some discussion about this on #31549 (it is also reported as a bug in python itself), and in the and this was fixed for I don't care much about how it is folved, but probably good to be consistent for
I would just leave it for 1.3 (it's not a regression like the other issue). You never know how some subclass might be using this method (or relying on the exact error class) |
makes sense. |
I've made a new version, where they're the same: |
doc/source/development/extending.rst
Outdated
``_constructor_sliced`` ``NotImplementedError`` ``Series`` | ||
``_constructor_expanddim`` ``DataFrame`` ``NotImplementedError`` | ||
=========================== ======================= ============= | ||
* ``DataFrame/Series._constructor``: Used when a manipulation result has the same (sub-)class as the original. |
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.
I would keep the "same dimension as the original", because it doesn't necessarily need to return the same class (eg a subclass' _constructor
can return a non-subclassed DataFrame in certain cases)
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.
I didn't like "same dimension as the original" because it could be understood like e.g. an array could be used, which would be wrong. By using "(sub-)class" is is implied that for e.g. for Series you have to supply a Series or a subclass of a Series (but not a DataFrame or a 1-dim array).
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.
Is this ok? My opinion is that it’s better to emphazise the type Here, rather than the dimensionality.
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.
I’ve changed this to say dimension rather than subclass. IDT the next gwo lines shares this issue, but let me know.
5f71dc3
to
af40a78
Compare
2850242
to
ed8528a
Compare
Ping. |
ed8528a
to
1b1bf16
Compare
thanks @topper-123 |
Make
inspect.getmembers(Series)
work, previously raised anAbstractMethodError
.xref: #38740