-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
PERF: fix merging on datetimelike columns to not use object-dtype factorizer #53231
Merged
mroeschke
merged 8 commits into
pandas-dev:main
from
jorisvandenbossche:perf-merge-datetime
May 31, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d5c7604
PERF: fix merging on datetimelike columns to not use object-dtype fac…
jorisvandenbossche 971f267
don't try to match resos for Arrow extension array
jorisvandenbossche caec63a
fix typing
jorisvandenbossche 35a650d
try fix typing
jorisvandenbossche 47e6bd7
Merge remote-tracking branch 'upstream/main' into perf-merge-datetime
jorisvandenbossche 52c768b
update dtypes check
jorisvandenbossche fafb61d
Merge remote-tracking branch 'upstream/main' into perf-merge-datetime
jorisvandenbossche d46d7c4
add whatsnew
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 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 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 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
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.
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 part was (accidentally?) removed in #49876. So there won't be any tests failing from leaving this out (because falling back to the object factorizer also gives correct results), but it is necessary to ensure we use the faster factorizer for datetimelikes
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 expect that the relevant cases should go through the
elif isinstance(lk, ExtensionArray) and lk.dtype == rk.dtype:
branch above?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.
Not fully:
if isinstance(lk.dtype, DatetimeTZDtype) ...
block by getting the_ndarray
of lk and rk (but we could not do that there, and let it go through the block that calls_values_for_factorize
)DatetimeArray._values_for_factorize
returns the_ndarray
, which is the M8 numpy array, not an integer numpy array. So we still need thisneeds_i8_conversion
.Now, we should maybe change
_values_for_factorize
? (but that's probably more for something targetting 2.1, and didn't check the other places where_values_for_factorize
is being used)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.
makes sense, thanks.