-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Series.str.get_dummies() raise on string type (follow up to PR #59577) #59786
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
Merged
rhshadrach
merged 47 commits into
pandas-dev:main
from
aaronchucarroll:stringmethods-get-dummies
Jan 22, 2025
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
e6f9527
Add prefix, prefix_sep, dummy_na, and dtype args to StringMethods get…
aaronchucarroll dafb61d
Fix import issue
aaronchucarroll bb79ef2
Fix typing of dtype
aaronchucarroll 24be84f
Fix NaN type issue
aaronchucarroll 09b2fad
Support categorical string backend
aaronchucarroll 50ed90c
Fix dtype type hints
aaronchucarroll 9e95485
Add dtype to get_dummies docstring
aaronchucarroll 9a47768
Fix get_dummies dtype docstring
aaronchucarroll 0c94bff
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 9702bf7
remove changes for unnecessary args
aaronchucarroll 8793516
Merge branch 'stringmethods-get-dummies' of https://github.com/aaronc…
aaronchucarroll bad1038
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 163fe09
parametrize dtype tests
aaronchucarroll 3d75fdc
Merge branch 'stringmethods-get-dummies' of https://github.com/aaronc…
aaronchucarroll d68bece
support pyarrow and nullable dtypes
aaronchucarroll c2aa7d5
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 0fd2401
fix pyarrow import error
aaronchucarroll 920c865
skip pyarrow tests when not present
aaronchucarroll 800f787
split pyarrow tests
aaronchucarroll d8149e6
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 6cbc3e8
parametrize pyarrow tests
aaronchucarroll 532e139
change var name to dummies_dtype
aaronchucarroll cd5c2ab
fix string issue
aaronchucarroll 822b3f4
consolidate conditionals
aaronchucarroll ba05a8d
add tests for str and pyarrow strings
aaronchucarroll 37dddb8
skip pyarrow string tests if not present
aaronchucarroll 6fbe183
add info to whatsnew doc
aaronchucarroll 87a1ee8
change func to meth in doc info
aaronchucarroll 8706af6
proposed changes from review
aaronchucarroll 9d7d7f8
raise ValueError on str types
aaronchucarroll fa41092
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 3d20d2b
fix typo from merge conflict
aaronchucarroll 392782c
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 870457e
fix precommit issue
aaronchucarroll 7ec0b5f
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 8e18ee0
fix minor issues
aaronchucarroll 798a8ea
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll 3ac320e
Merge branch 'main' into stringmethods-get-dummies
aaronchucarroll fbdddbb
revert previous string_dtype change
aaronchucarroll 8eec58e
Merge branch 'stringmethods-get-dummies' of https://github.com/aaronc…
aaronchucarroll a912bd8
test current setup
aaronchucarroll bd8c059
test remove pyarrow import
aaronchucarroll 961eb6c
Merge remote-tracking branch 'upstream/main' into stringmethods-get-d…
jorisvandenbossche 151316d
update import and test
jorisvandenbossche f829533
Merge remote-tracking branch 'upstream/main' into stringmethods-get-d…
jorisvandenbossche 171d381
Merge remote-tracking branch 'upstream/main' into stringmethods-get-d…
jorisvandenbossche 8b26e8c
restrict to numeric or boolean
jorisvandenbossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,7 +434,7 @@ def _str_get_dummies(self, sep: str = "|", dtype: NpDtype | None = None): | |
dummies_dtype = _dtype | ||
else: | ||
dummies_dtype = np.bool_ | ||
dummies = np.empty((len(arr), len(tags2)), dtype=dummies_dtype) | ||
dummies = np.empty((len(arr), len(tags2)), dtype=dummies_dtype, order="F") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aaronchucarroll @rhshadrach do you remember why this change was included? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see that is based on a comment from @mroeschke at #59577 (comment) |
||
|
||
def _isin(test_elements: str, element: str) -> bool: | ||
return element in test_elements | ||
|
rhshadrach marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.