-
-
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
Support construction of a DataFrame from a Mapping #58814
Conversation
d71995a
to
097b0d2
Compare
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.
Looks good to me! Can you please update the documentation of DataFrame.__init__
(around line 517) to mention Mapping instead of dict?
It might be good to check whether DataFrame.from_dict
can also accept a mapping.
d1ab519
to
9400c0d
Compare
@twoertwein I noticed that creating a DataFrame from a Mapping of Mappings wasn't covered, so I added support for it. Could you please review this new change? |
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.
Looks good to me!
(DataFrame.from_dict
is documented to allow also array-like types that contain Mappings but that can be a separate PR, pandas-dev/pandas-stubs#928 and pandas-dev/pandas-stubs#929)
b8273d0
to
375379d
Compare
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.
Please wait until the discussion on the issue reaches consensus
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. |
375379d
to
88cb50f
Compare
Thanks for the PR here, but let's centralize the discussion in the issue regarding whether pandas should make this more general. Closing for now, but we can reopen if there is consensus to change in the issue |
This pull-request adds support for using a
Mapping
in the construction of aDataFrame
. By applying this change, the following Julia code will work.I have confirmed that there is no performance degradation when constructing a
DataFrame
from adict
.__init__
on adict
toabc.collections.Mapping
and__getitem__
on alist
toabc.collections.Sequence
#58803 (only dataframe construction part)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.