-
-
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
BUG: merge should upcast to highest resolution #56310
Conversation
This only gets some of the cases. I think this misses when we take everything from the left join col. |
pandas/core/reshape/merge.py
Outdated
# TODO(non-nano) Workaround for common_type not dealing | ||
# with different resolutions | ||
result_dtype = key_col.dtype | ||
key_col = Index(lvals).astype(result_dtype).where(~mask_left, rvals) |
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.
pass copy=False?
Do you have an example? That'd save me some time in figuring out what code paths that case goes through |
Sorry for the slow reply. I think my changes here only fixed the result for outer/right merges. The tests that I've added that are failing are doing so for inner/left merges. Here's a MRE.
|
@@ -761,6 +761,7 @@ Datetimelike | |||
- Bug in parsing datetime strings with nanosecond resolution with non-ISO8601 formats incorrectly truncating sub-microsecond components (:issue:`56051`) | |||
- Bug in parsing datetime strings with sub-second resolution and trailing zeros incorrectly inferring second or millisecond resolution (:issue:`55737`) | |||
- Bug in the results of :func:`to_datetime` with an floating-dtype argument with ``unit`` not matching the pointwise results of :class:`Timestamp` (:issue:`56037`) | |||
- Fixed bug in :meth:`DataFrame.merge` not being able to join on ``datetime64`` columns of differing resolutions (:issue:`55212`) |
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.
in main they are able to join just gives the wrong result reso?
The code change looks good to me. The test change looks plausible but i haven't examined closely. |
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. |
Looks like this PR has gone stale and needs a rebase. Closing to clear the queue but feel free to reopen when you have time to circle back |
df1.merge(df2, on='ds', how='outer')
not convert columnds
to the highest resolution datetime type of the two dfs #55212 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.