Skip to content

Conversation

Huanghz2001
Copy link
Contributor

@Huanghz2001 Huanghz2001 commented Dec 24, 2023

@Huanghz2001 Huanghz2001 marked this pull request as draft December 24, 2023 18:06
@Huanghz2001 Huanghz2001 marked this pull request as ready for review December 26, 2023 04:07
@@ -1526,6 +1528,11 @@ def _maybe_coerce_merge_keys(self) -> None:
) or (lk.dtype.kind == "M" and rk.dtype.kind == "M"):
# allows datetime with different resolutions
continue
# datetime and timedelta not allowed
elif is_datetime64_dtype(lk.dtype) and is_timedelta64_dtype(rk.dtype):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check the dtype.kind instead of using these methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'll check dtype.kind to keep consistent with the logic above.

@mroeschke mroeschke added Datetime Datetime data dtype Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type labels Dec 27, 2023
@phofl
Copy link
Member

phofl commented Dec 28, 2023

thx @Huanghz2001

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Dec 28, 2023
phofl pushed a commit that referenced this pull request Dec 28, 2023
…atetime columns with timedelta columns) (#56658)

Backport PR #56613: BUG: Added raising when merging datetime columns with timedelta columns

Co-authored-by: Huanghz2001 <[email protected]>
cbpygit pushed a commit to cbpygit/pandas that referenced this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: dtype of right merge between datetime and timedelta depends on presence of NaT
3 participants