-
-
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
Better support for UserDict on constructor #55109
Conversation
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.
Could you add a new in the whatsnew 2.2.0.rst
?
Well observed, @marcelotrevisani - Mapping is better here |
@mroeschke is this good to go? :-) |
Co-authored-by: Marcelo Duarte Trevisani <[email protected]>
@datapythonista |
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
@@ -29,7 +29,7 @@ enhancement2 | |||
Other enhancements | |||
^^^^^^^^^^^^^^^^^^ | |||
- DataFrame.apply now allows the usage of numba (via ``engine="numba"``) to JIT compile the passed function, allowing for potential speedups (:issue:`54666`) | |||
- | |||
- It is now possible to pass an object that either directly inherits from ``abc.Mapping`` or has it in its inheritance chain to initialize a DataFrame. The expected behaviour is the same as if you pass a ``dict`` object. (:issue:`55109`) |
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.
- It is now possible to pass an object that either directly inherits from ``abc.Mapping`` or has it in its inheritance chain to initialize a DataFrame. The expected behaviour is the same as if you pass a ``dict`` object. (:issue:`55109`) | |
- :class:`DataFrame` now accepts ``data`` that are ``abc.Mapping`` subclasses. (:issue:`55109`) |
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.
Could you test the Series
constructor too?
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
I noticed that if I create my DataFrame passing a dictionary which is a custom one of a subclass of
collections.UserDict
then we have incompatible behaviour with the one if I pass a builtindict
.The idea is that the
UserDict
should have the same type interface as thedict
and used for custom behaviour, instead of subclassing direct fromdict
.This PR attempts to fix that incompatibility issue.
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.