Let get_dummies use meta computation in map_partitions#8898
Merged
Let get_dummies use meta computation in map_partitions#8898
get_dummies use meta computation in map_partitions#8898Conversation
jcrist
approved these changes
Apr 7, 2022
jcrist
reviewed
Apr 7, 2022
| # We explicitly create `meta` on `data._meta` (the empty version) to | ||
| # work around https://github.com/pandas-dev/pandas/issues/21993 | ||
| package_name = data._meta.__class__.__module__.split(".")[0] | ||
| dummies = sys.modules[package_name].get_dummies |
Member
There was a problem hiding this comment.
😮 Just noticed this code, what a hack!
Member
Author
There was a problem hiding this comment.
YEAH that is intense. I feel like it's probably not necessary but I'm not 100% sure what the best practice is. I guess maybe we should have a dispatch for this method? I don't really know how this is solved for the dataframe case. Like ideally calling pd.get_dummies on a dataframe would return a datatframe with the same type as the input but I'm not sure if that is the case?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pre-commit run --all-filesBased on the note that I am deleting here, I suspect that this is no longer necessary. Let's see if the tests pass 🤞